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

color hierarchy issue #11

Open
dwelle opened this issue Aug 9, 2019 · 4 comments
Open

color hierarchy issue #11

dwelle opened this issue Aug 9, 2019 · 4 comments

Comments

@dwelle
Copy link

dwelle commented Aug 9, 2019

It seems that a nested color affects a sibling color when a color is applied to both strings up a level.

('aaa' + 'bbb'.magenta).red

leads to aaa in red and bbb in magenta, but when doing:

('aaa'.white + 'bbb'.magenta).red

the white bleeds into bbb (making it pink) for no apparent reason:

image

repro:

$ node
> console.log(('aaa'.white + 'aaa'.magenta).red)
> console.log(('aaa'.white + 'aaa'.magenta))
> console.log(('aaa' + 'aaa'.magenta).red)

version: 1.1.92

@ChocolateLoverRaj
Copy link

@dwelle How do the String.prototype colors work?

@dwelle
Copy link
Author

dwelle commented Sep 23, 2020

@ChocolateLoverRaj
Copy link

@dwelle I saw how to use the nice mode, but how does it actually work internally? Does the actual text change as soon as you call the white method? Then when you call the method again with the red is it supposed to only change the colors of non colored characters?

@dwelle
Copy link
Author

dwelle commented Sep 23, 2020

Does the actual text change as soon as you call the white method

it must

Then when you call the method again with the red is it supposed to only change the colors of non colored characters?

I'd say so, yes.

Note, I'm not the author.

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

2 participants