Comments (7)
There is already a handelbars helper called hex2rgb
which returns the incoming hex string as an {r, g, b}
object. (It's nearly the same as the inkscape template)
You basically have to call the helper on each color.hex
and put the result where you want it to be (in the .css
template file).
I could do it if nobody else wants to take this issue.
from open-color.
we can use https://github.com/sindresorhus/hex-rgb
from open-color.
Hi! That seems to be great idea, even though I'm not familiar with new css custom props. Currently Open color is being automatically generated from configuration file (https://github.com/yeun/open-color/blob/master/open-color.json) and they are described as HEX values, so it needs to be converted while they are generated. (https://github.com/yeun/open-color/blob/master/compile-templates.js) I'll take a look when I'll have time, but of course you can submit PR if you want. Thanks for suggestion 😄
from open-color.
Hey, great, it should be pretty easy. This works fine and gives you an array with the rgb values.
const hexToRgb = hex =>
hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i
,(m, r, g, b) => '#' + r + r + g + g + b + b)
.substring(1).match(/.{2}/g)
.map(x => parseInt(x, 16))
Usage e.g.:
console.log(hexToRgb("#0033ff")) // [0, 51, 255]
source: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
CSS Custom properties is the official name for css variables, as use in https://github.com/yeun/open-color/blob/master/open-color.css
from open-color.
Even better.
from open-color.
@makepanic I will not get to it soo, so if you could do it that would be great.
from open-color.
@makepanic Oh, I haven't noticed. Please work on, if you don't mind 😄
from open-color.
Related Issues (20)
- Dark mode support HOT 2
- Latest published version on npm still depends on npm HOT 2
- chromatic
- [FEATURE IDEA]Add click to copy feature
- Add PostCSS-import compatible endpoint
- Feature request: Add additional dark colors HOT 1
- Question: Grey 6 accessibility
- macOS Color Palette download broken
- Photoshop swatches -1.9.1.aco download failed (no file)
- How get all colors?
- HD color HOT 2
- New two scale
- Suggestions for additional colors HOT 4
- Gravit Designer HOT 2
- Gaps between Gray 4-Gray 7. HOT 2
- Swatches for Affinity Designer
- How to match with base/brand color? HOT 12
- npm prepublish is deprecated HOT 1
- Provide a Figma Library
- Arbitrary File Overwrite - 1.7.0 Open Color
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-color.