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

Theme properties return object when mode == 'none' #20

Merged
merged 2 commits into from
Sep 6, 2012
Merged

Conversation

cjc
Copy link
Contributor

@cjc cjc commented Jan 19, 2012

example

When colors.mode == 'none', properties created by setTheme({error:'red'}) return an object instead of a string.

It looks like all the properties added by applyTheme have this behaviour of exploding strings into objects, but stylize coerces them back to strings if mode is console or browser.

Changes:
Add tests for return type of .red and .error properties for all three modes.
Modify stylize 'none' case to coerce back to strings.

This is obviously not an ideal fix, but I cannot work out WHY the applyTheme properties explode the strings into objects like that, so I've just brought 'none' into line with console and browser.

@cowboy
Copy link

cowboy commented Sep 5, 2012

I've just encountered this as well. When colors.mode = 'none'; all methods return this passed in as str. Because this is a String instance (object) things break. The str needs to be coerced to a string primitive before it is returned.

Please fix this!

@Marak
Copy link
Owner

Marak commented Sep 5, 2012

Will push out a new version tonight.

Thanks

Marak added a commit that referenced this pull request Sep 6, 2012
[fix] Theme properties return object when mode == 'none'
@Marak Marak merged commit e9604a5 into Marak:master Sep 6, 2012
fouber pushed a commit to fouber/colors.js that referenced this pull request May 22, 2013
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

Successfully merging this pull request may close these issues.

None yet

3 participants