GithubHelp home page GithubHelp logo

export to HTML palette about chroma HOT 6 OPEN

jfairbank avatar jfairbank commented on July 22, 2024
export to HTML palette

from chroma.

Comments (6)

jfairbank avatar jfairbank commented on July 22, 2024

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?

from chroma.

Trevoke avatar Trevoke commented on July 22, 2024

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

from chroma.

jfairbank avatar jfairbank commented on July 22, 2024

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.

from chroma.

Trevoke avatar Trevoke commented on July 22, 2024

The main purpose I hope to achieve is to view the colors.

from chroma.

jfairbank avatar jfairbank commented on July 22, 2024

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?

from chroma.

Trevoke avatar Trevoke commented on July 22, 2024

That sounds pretty awesome, yes!

from chroma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.