-
Notifications
You must be signed in to change notification settings - Fork 29
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
export to HTML palette #20
Comments
Hi @Trevoke. I like this idea, but I think baked in HTML serialization is out of the scope of this gem. However, I do like the idea of supporting custom serialization similar to supporting custom palettes, so I would be comfortable with something like: # call define_color_serializer with name and block that is instance_eval'd by the color
Chroma.define_color_serializer :to_html do
%{<span class="color-swatch" style="background-color: #{to_hex}"></span>}
end
'red'.paint.to_html #=> <span class="color-swatch" style="background-color: #ff0000"></span> Is that output kind of what you were referring to? |
I admit that, being a web developer, I just can't imagine any context for hex colors beyond CSS, which is why I thought it would be a wonderful addition to the gem. I imagined something like a pre-baked, HTML+CSS, version of a palette like this one (first available on the site when I went to it): http://www.colourlovers.com/palette/3621455/fewer . Beyond this, my suggestion is to solve for one use case first, and then make it more generic when more use cases come up. And finally, I understand that HTML serialization might deform and denature the gem, so I do understand if you leave that out. Maybe I'll just have to build a wrapper gem :D |
Hey, @Trevoke. Sorry for the absence. I'm still not sure that I'm sold on this. It's a neat idea, but the main issue I see with serializing to HTML/CSS is the assumptions I need to make about what that looks like versus what others might want. What is it you hope to achieve with this functionality? Do you want to just preview the colors and custom palettes? Or do you actually want some type of HTML/CSS output that you use directly in an app? I have some ideas for either approach. |
The main purpose I hope to achieve is to view the colors. |
OK, so after thinking about this, I belive I'm good with this idea. It could be helpful to visualize the colors, especially for custom palettes you can define (in addition to the default palettes). What I envision is a rack server for this that you can run locally to play with the colors. A command line binary could work as well, but the server would have the benefit of allowing you to type in the base color you want to try out instead of constantly rerunning a binary. Does that sound like something you're looking for? |
That sounds pretty awesome, yes! |
It would be nice, for those of us who are hex-impaired, to be able to see it in a browser somehow. Maybe just export to HTML string for starters?
The text was updated successfully, but these errors were encountered: