Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colored text #9

Closed
jroimartin opened this issue Jan 23, 2014 · 14 comments
Closed

Colored text #9

jroimartin opened this issue Jan 23, 2014 · 14 comments
Assignees
Milestone

Comments

@jroimartin
Copy link
Owner

Add support for colored text. E.g.: fmt.Println(v, "Regular text and [yb:Yellow bold text]")

@ghost ghost assigned jroimartin Jan 23, 2014
@kgilmer
Copy link

kgilmer commented Mar 5, 2014

+1 on this feature. I made an experimental change in my fork to allow client access to View.fgColor and View.bgColor but this only allows changing the entire view.

To implement color as above, is there some strategy or library from extracting the color information from the string "Regular text and [yb:Yellow bold text]"?

@jroimartin
Copy link
Owner Author

Sorry for the delay kgilmer, but I've been working on other projects (I plan to come back to the gocui development really soon :). Regarding your question, I was thinking on designing some kind of custom-syntax easily parseable using regexp.

@alexdreptu
Copy link

+1 colors per view would be extremely nice and useful.

@hazbo
Copy link
Contributor

hazbo commented Jul 13, 2014

There are two nice packages I have come across recently that could come in handy. colorstring was released less than a day ago. Faith's color package is pretty useful, I've used this one recently.

@beefsack
Copy link

Hi @jroimartin, just wondering if there was any plan around this one? Would love to use this library over using termbox directly for a project I'm just kicking off.

Happy to contribute if you had a high level idea of where you want to go with it.

@jroimartin
Copy link
Owner Author

Hi Michael,

Right now I'm working on giving gocui a real full edition mode. And then I
would like to decouple it, so the user can set his own keybinding. This way
it would be trivial to set up an emacs mode, vim mode or custom mode.

After finishing these two tasks my idea is to implement color support, but
first I think we should discuss about which is the better approach for
defining colors. E.g.: using ANSI codes, user-friendly syntax, etc. Also
it will probably change some internals...

In short, my plan is to implement it after finishing the full edition mode
(very soon I hope). But if you want to discuss about it and contribute with
a PR that would be awesome! :)

@beefsack
Copy link

Hi @jroimartin, the new version sounds good, might be worth waiting until that's done.

The benefit of ANSI codes in the input might be because you could still use an io.Writer without big changes to the API. This would actually work quite well for my project as I've already got an ANSI renderer in place.

The benefit to having a concrete API for triggering colour changes would be user friendliness.

It would be interesting to see if it would work having a defined interface, but internally it just generated the appropriate ANSI escape code and sent it to the io.Writer. This might mean that you could have the best of both worlds.

@hojgr
Copy link

hojgr commented Sep 12, 2015

Hello,

I would like to know what's the status for this? I would like to use colored text in a project I am working on. I tried ANSI but those are apparently escaped :)

Thanks

@jroimartin
Copy link
Owner Author

It is still a work in progress and, hopefully, I will implement it soon using ANSI codes to specify the colours.

@jroimartin jroimartin modified the milestones: GoCUI 0.3, GoCUI 0.2 Jan 30, 2016
@deweerdt
Copy link

I've implemented basic support for ANSI escape characters in #39

@jroimartin
Copy link
Owner Author

@deweerdt cool! Color support is the number one priority for v0.3. I'll give it a look in the next days :)

@deweerdt
Copy link

@jroimartin I've noticed some issues yesterday with the current patch: attributes don't survive a line change. I'll post an updated version this week.

@deweerdt
Copy link

Ok, I've added the fix to PR #39

@jroimartin jroimartin added the wip label Apr 27, 2016
@jroimartin jroimartin removed the wip label May 22, 2016
@jroimartin
Copy link
Owner Author

Merged!

RIscRIpt pushed a commit to RIscRIpt/gocui that referenced this issue Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants