Thread overview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 21, 2012 [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Hello, I would like to introduce ColorD, small library that allows to simply manipulate console output colors, both on Windows and Posix operating systems. It also supports font styles such as underline and strikethrough(Posix feature only). Simple example: import std.stdio, colord; void main() { setConsoleColors(Fg.red, Bg.blue); writeln("Red text on blue background."); resetConsoleColors(); // Bring back initial state } Feedback welcome. GitHub: https://github.com/robik/ColorD Regards. |
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robik | Robik wrote: > I would like to introduce ColorD, small library that allows to simply manipulate console output colors, both on Windows and Posix operating systems. > GitHub: https://github.com/robik/ColorD On windows I got an error: Not a property <EnumTypedef!<color,"fg">>.opDispatch Same for "bg". void resetConsoleColors() { setConsoleColors(Fg.initial, Bg.initial); // here } Peter |
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Peter Sommerfeld | On Sunday, 21 October 2012 at 20:19:54 UTC, Peter Sommerfeld wrote:
> Robik wrote:
>
>> I would like to introduce ColorD, small library that allows to simply manipulate console output colors, both on Windows and Posix operating systems.
>
>> GitHub: https://github.com/robik/ColorD
>
> On windows I got an error:
> Not a property <EnumTypedef!<color,"fg">>.opDispatch
> Same for "bg".
>
> void resetConsoleColors()
> {
> setConsoleColors(Fg.initial, Bg.initial); // here
> }
>
> Peter
What version are you using?
|
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robik | Robik:
> GitHub: https://github.com/robik/ColorD
Maybe it'ìs better to call it ConsoleColorsD, or something. ColorD seems more fit for a (handy) library about color theory, color space conversions, etc.
Bye,
bearophile
|
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robik | Robik wrote:
> Hello,
>
> I would like to introduce ColorD, small library that allows to simply manipulate console output colors, both on Windows and Posix operating systems. It also supports font styles such as underline and strikethrough(Posix feature only).
It might be nice to have a solution which works better with native writeln(), aka, something like:
import std.stdio, colord;
void main() {
writeln(Colors.Red, "Foo Bar", Colors.Reset);
}
|
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Sunday, 21 October 2012 at 20:39:31 UTC, bearophile wrote: > Robik: > >> GitHub: https://github.com/robik/ColorD > > Maybe it'ìs better to call it ConsoleColorsD, or something. ColorD seems more fit for a (handy) library about color theory, color space conversions, etc. > > Bye, > bearophile Moved to https://github.com/robik/ConsoleD |
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robik | Robik wrote: > Hello, > > I would like to introduce ColorD, small library that allows to simply manipulate console output colors, both on Windows and Posix operating systems. It also supports font styles such as underline and strikethrough(Posix feature only). > > > Simple example: > > import std.stdio, colord; > void main() > { > setConsoleColors(Fg.red, Bg.blue); > writeln("Red text on blue background."); > resetConsoleColors(); // Bring back initial state > } > > > Feedback welcome. > > GitHub: https://github.com/robik/ColorD Interesting looks solid to me. Some nit-picks: * Coloring on Posix depends a ANSI terminal. Can you check that a terminal is ANSI compatible? * There are some magic numbers in the code. These may be difficult to figure out for maintaining. * enum Color should maybe be same on all systems. This is a rather small issue. But I may transfer the Color to another system. So if it is possible there should only be one enum Color for all systems. * Call it terminal or similar. Because other terminal related stuff can be added and IMHO it's a better name. I have written a similar library. Not finished. Let's join forces. https://github.com/jkm/terminal Johannes Pfau has written a progress bar. I will add this. Jens |
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jens Mueller | On Sunday, 21 October 2012 at 21:01:21 UTC, Jens Mueller wrote: > Interesting looks solid to me. > Some nit-picks: > * Coloring on Posix depends a ANSI terminal. Can you check that a terminal is ANSI compatible? Sure, why not. > * There are some magic numbers in the code. These may be difficult to > figure out for maintaining. I will fix this. > * enum Color should maybe be same on all systems. > This is a rather small issue. But I may transfer the Color to another > system. So if it is possible there should only be one enum Color for > all systems. I think that this will only complicate the code. > * Call it terminal or similar. Because other terminal related stuff can > be added and IMHO it's a better name. It got renamed to ConsoleD. > I have written a similar library. Not finished. Let's join forces. > https://github.com/jkm/terminal > > Johannes Pfau has written a progress bar. I will add this. > > Jens Sure, I'm interested in joining forces. Do you have IRC? |
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robik | Robik wrote: > On Sunday, 21 October 2012 at 21:01:21 UTC, Jens Mueller wrote: > >Interesting looks solid to me. > >Some nit-picks: > >* Coloring on Posix depends a ANSI terminal. Can you check that a > >terminal is ANSI compatible? > > Sure, why not. Do you know how to do this? > >* There are some magic numbers in the code. These may be difficult to > > figure out for maintaining. > > I will fix this. > > >* enum Color should maybe be same on all systems. > > This is a rather small issue. But I may transfer the Color to > >another > > system. So if it is possible there should only be one enum Color > >for > > all systems. > > I think that this will only complicate the code. Probably not worth the trouble. But it should be documented. > >* Call it terminal or similar. Because other terminal related stuff can > > be added and IMHO it's a better name. > > It got renamed to ConsoleD. But the module should not be named colsoled. Because it's a D module anyway. Call it just console. > >I have written a similar library. Not finished. Let's join forces. https://github.com/jkm/terminal > > > >Johannes Pfau has written a progress bar. I will add this. > > > >Jens > > Sure, I'm interested in joining forces. Do you have IRC? Yes, I do. Jens |
October 21, 2012 Re: [RFC] ColorD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robik | On Sunday, 21 October 2012 at 19:28:21 UTC, Robik wrote:
> I would like to introduce ColorD, small library that allows to simply manipulate console output colors, both on Windows and Posix operating systems. It also supports font styles such as underline and strikethrough(Posix feature only).
Does this rely on nCurses? (or similar)
|
Copyright © 1999-2021 by the D Language Foundation