Thread overview
textattr library for text colors and attributes available in D
Nov 08, 2018
Shriramana Sharma
Nov 08, 2018
Bastiaan Veelo
Nov 09, 2018
Shriramana Sharma
Nov 09, 2018
JN
Nov 23, 2018
Shriramana Sharma
Nov 24, 2018
Basile B.
November 08, 2018
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

November 08, 2018
On Thursday, 8 November 2018 at 13:37:08 UTC, Shriramana Sharma wrote:
> 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

Cool, must remember this in case I need it one day. Do you have plans to add it to the dub registry?
November 09, 2018
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…
November 09, 2018
On Friday, 9 November 2018 at 03:02:01 UTC, Shriramana Sharma wrote:
> 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…

You can find the instructions on how to create a dub package here: http://code.dlang.org/publish

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.
November 23, 2018
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.
November 24, 2018
On Thursday, 8 November 2018 at 13:37:08 UTC, Shriramana Sharma wrote:
> 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

i was thinking to something like this the other day:


struct ColoredText(int color)
{
    string payload;
    alias payload this;
}

with a writeln() like function that check if the args are template instances of ColoredText.


or even more versatile:

@Color!Blue string b1, b2;
@Color!Red  string r1, r2;
@Color!Green int i1, i2;


with a writeln() like function that inspects the UDA or the args.