Re: termcolor-d - Colors with writeln(...);

2018-11-22 Thread Shriramana Sharma via Digitalmars-d-announce
On Wednesday, 21 November 2018 at 18:36:06 UTC, Vladimirs 
Nordholm wrote:

https://github.com/vladdeSV/termcolor-d


https://github.com/jamadagni/textattr/

Saw a library recently which allowed you to color text, but it 
had an odd syntax.


Maybe the documentation, in trying to be exhaustive, hasn't 
showed how simple it can be. I'm not sure why it is perceived as 
odd. Can you clarify?


Since I already had some code for coloring text in terminals, I 
made this (hackish, POSIX only) project during lunch break. It 
in action:


import std.stdio : writeln;
import termcolor;


import textattr;


// Color → Green → Foreground
writeln(C.green.fg, "Green text", resetColor);


  writeln(ta("green"), "Green text", ta("off"));

*or* the shorter:

  writeln(ta("g"), "Green text", ta("f"));

*or* the even shorter:

  tawrite("@g", "Green text", "@f", '\n');

The @ indicates that it is an "at"tribute.

It's not an issue to add a tawriteln which adds the newline at 
the end. I first posted the basic library thinking to make 
additions as per demands later.



// Color → Red → Background
writeln(C.red.bg, "Red background", resetColor);


  tawrite("@/red", "Red background", "@off", '\n');

The / indicates that it's a background colour. This is stated in 
the HTML documentation, but maybe not clear within the 
limitations of the README.md. I'll see what I can do to improve 
it.


Having premade symbols in the library as you have done is easy 
enough for basic 16-colour or even attribute support, but adding 
256 colour or true colour support this way would unnecessarily 
use up too much memory.


Re: textattr library for text colors and attributes available in D

2018-11-22 Thread Shriramana Sharma via Digitalmars-d-announce

On Friday, 9 November 2018 at 22:28:28 UTC, JN wrote:
It looks to me like the textattr.d is all that is needed? 
Should be easy to put it in a separate package that could be 
uploaded to dub registry.


Yes indeed textattr.d is all that is needed! For C too 
textattr.c|h are all that are needed.


Re: textattr library for text colors and attributes available in D

2018-11-08 Thread Shriramana Sharma via Digitalmars-d-announce
On Thursday, 8 November 2018 at 19:26:15 UTC, Bastiaan Veelo 
wrote:
Cool, must remember this in case I need it one day. Do you have 
plans to add it to the dub registry?


Don't know how. Can follow instructions if provided. Does DUB 
also allow multi-language libs one of which is D?


Unfortunately my D usage isn't as much as I'd like it to be so 
haven't kept up so closely…


textattr library for text colors and attributes available in D

2018-11-08 Thread Shriramana Sharma via Digitalmars-d-announce

https://github.com/jamadagni/textattr/

textattr is a library and command-line tool that makes adding 
color and attributes to beautify the terminal output of your 
program easier by translating human-readable specs into ANSI 
escape codes.


The library is available for C, C++, Python and D. C++ and Python 
use the C code for internal processing but the D code is a 
separate implementation for easy inclusion of textattr.d in a D 
compilation command without requiring any external linking.


Copyright: Shriramana Sharma, 2018
License: BSD-2-Clause



Re: Please vote for the DConf logo

2015-11-10 Thread Shriramana Sharma via Digitalmars-d-announce
I prefer 3. It's simple, but effective. The graphic looks 
like an Olympic torch to me, which is good, indicating that D 
is a champion! :-)

IMHO 2 needs the graphic to be more stylistic, otherwise it's 
good and simple. If it is improved, maybe it can be used 
later/elsewhere.

But I don't get the message of 1. The graphic is too 
complicated, and the significance of its components is not 
self-evident.

Appreciate the work people are putting into this, though. No 
offence to any artist intended...

-- 
Shriramana Sharma, Penguin #395953


Dhee - tiny app to learn/try out D

2015-11-10 Thread Shriramana Sharma via Digitalmars-d-announce
I wrote up a small PyQt app to help me do quick coding of snippets in D to 
help me learn how D works.

https://github.com/jamadagni/dhee

I wish there was (a working) QtD so I wouldn't need to use Python, but 
well... Looked into GtkD a bit, but somehow Gtk never clicked with me...

P.S.: I only cross-posted as I thought this is relevant to both 
announce/learn.

-- 
Shriramana Sharma, Penguin #395953


Re: Moving forward with work on the D language and foundation

2015-10-12 Thread Shriramana Sharma via Digitalmars-d-announce
Respect to Andrei for his decision, and I pray that his good intentions are 
sufficiently rewarded.

Jonathan M Davis via Digitalmars-d-announce wrote:

> Wow. Sounds financially risky on your part, but if you can afford to do
> this, then it'll be great for the D community at large. The more resources
> we can have focused on D, the better.

Hopefully companies which are interested in leveraging D's 
performance/syntax combination will consult with the Foundation and so the 
finances (both the Foundation's and thereby Andrei's) will be taken care of. 
The Python foundation seems to have done that nicely for Python. 

While I'm still "getting my D-legs" (< 
https://en.wiktionary.org/wiki/sea_legs) I do think D is the right way to 
combine Python-like high level syntax and C/C++-level power. I tried Cython 
but somehow it didn't click for me. And as for Go and Rust and all those 
other contenders, naah... [Is it even possible to write a Go/Rust compiler 
in Go/Rust? Or have they tried?]

Of course, all this is made possible by the great D community, the "Demos" 
(https://en.wiktionary.org/wiki/demos#Latin). [Sorry, somehow I'm in the 
dictionary/alliteration mood ;-)]

Shriramana Sharma.



Re: [OT?] C compiler written form scratch in D

2014-12-08 Thread Shriramana Sharma via Digitalmars-d-announce
On Monday, December 8, 2014, Stefan Koch via Digitalmars-d-announce 
digitalmars-d-announce@puremagic.com wrote:


 Please tell me what you think if that announcement, and feel free to ask
 anything you


Please do post updates here. I think it would be a great show-casing of D's
capabilities.

Just a suggestion and I may be totally off mark here, but will you have it
directly output machine code? Or just the front end? I keep hearing praises
of LLVM back-end so if your compiler outputs the LLVM IR code then maybe
you can have the rest of the benefit from LLVM.

But of course, if this is a PoC that D Caen be used to write a full
compiler to output machine code then LLVM's off...


-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा