@3mo/color
v0.1.7
Published
A utility for immutable colors parsed from any CSS color string and converted to hex, RGB, HSL and keywords.
Keywords
Readme
Color
A utility for immutable colors parsed from any CSS color string and converted to hex, RGB, HSL and keywords.
Installation
npm install @3mo/colorimport { Color } from '@3mo/color'Usage
<mo-flex direction='horizontal' gap='16px' alignItems='center'>
<div style='inline-size: 64px; block-size: 64px; border-radius: var(--mo-border-radius); background: ${color}'></div>
<mo-flex gap='4px'>
<code>${color.hex}</code>
<code>${color.rgb}</code>
<code>${color.hsl}</code>
<code>${color.keyword}</code>
</mo-flex>
</mo-flex>Examples
- Parsing — Any CSS color string parses: hex with or without alpha,
rgb(),hsl()and keywords.
API
Exports
| Name | Kind | Description |
| --- | --- | --- |
| Color | class | An immutable color parsed from a CSS color string, convertible to hex, RGB, HSL and keyword. |
Links
License
MIT © 3MO GmbH
