2.0.2 • Published 2 years ago

color-parse v2.0.2

Weekly downloads
152,179
License
MIT
Repository
github
Last release
2 years ago

color-parse test size stable

Fast and compact color string parser.

$ npm install color-parse

var parse = require('color-parse')

parse('hsla(12 10% 50% / .3)')
// { space: 'hsl', values: [12, 10, 50], alpha: 0.3 }

Parsed strings

  • Color keywords: red, green etc., see color-name
  • #RGB[A]
  • #RRGGBB[AA]
  • rgb[a](R, G, B[, A])
  • rgb(R G B[ / A])
  • hsl[a](H, S, L[, A]), inc. named hues
  • hsl(H S L [ / A])
  • hwb(H, W, B)
  • cmyk(C, M, Y, K)
  • xyz(X, Y, Z)
  • luv(L, U, V)
  • luv(L U V[ / A])
  • lab(L, A, B)
  • lab(L a b[ / A]) - see limits
  • lch(L, C, H)
  • lch(L C H[ / A]) - see limits
  • oklab(L a b[ / A]) - see limits
  • oklch(L C H[ / A]) - see limits
  • color(space c1 c2 c3[ / A])
  • R:10 G:20 B:30
  • (R10 / G20 / B30)
  • C100/M80/Y0/K35
  • [10, 20, 20] as RGB
  • 10,20,20 as RGB
  • 0x00ff00, 0x0000ff numbers as RGB

Not parsed

  • unknown strings eg. 'yellowblue'
  • not strings: object, arrays etc.

Related

  • color-space — collection of color space conversions.
  • color-rgba — convert any color string to rgba array.
  • color-alpha — change alpha component of any color.

Analogs

  • parse-color — parser by @substack. Performs calculations to every possible space, which bloats size.
  • color-parser — parser by @tjholowaychuk. Supports limited set of spaces.
  • color-string — parsing/serializing module by Heather Arthur. Has extensive API for parsing and serializing from any to any space.

NPM

@everything-registry/sub-chunk-1355start-appsvg-to-pdfthree-maphotpay-custom-componentsguest-chat-uimaterial-nativelmdb-indexkpmp-custom-plotly.js@timeax/valet@uoa-eresearch/plotly.js@useaward/embed@zalastax/nolb-color-@zhigang1992/react-native-shadow-viewabobaker-editorained-ckeditor5f2c-serverexpect-colorfe-utilchannel-colorscolor2color-compositecolor-alphacolor-interpolatecolor-rgbacustom-plotly.jscsnfautoman-runnertint-n-tinge@infinitebrahmanuniverse/nolb-color-p5nodejsnw-discord.js-commandoocmapreactxp-shadowreact-figmapengubinplotly.jsplotly.js-esmplotly.js-cartesian-esmplotly.js-fix2posthtml-transformpostcss-blurry-gradient-workaroundprime-graphicsgl-spectrogramgl-spectrum@nuggxyz/dotnugg-sdk@northernlight/react-page-editor@lona/workspace-to-sketch-library@springmicro/page@a-type/ui@promopixel/editor@blankparenthesis/pxlsspace@ckeditor/ckeditor5-ui@ckd/vue-button@assembless/tint-n-tinge@craftedsro/react-page-editor@concrete-design/core@crunchr/plotly.js@dansreis/react-canvas-annotator@dhilt/plotly.js@giangtong/plotly.js@giliweb/plotly.js@newcrom/plotly.js@shapething/shacl-renderer@easyv/utils@fabwcie/ckeditor5-preview@finos/legend-art@grida/transparency-grid@habx/ui-core@hussam-001/editor@hussam-001/react-page-editor@hoangho1147/hoang-sankey-plotly@heyform-inc/embed@hfribeiro/ska-plotly@idea-ionic/agenda@img-arena/img-ui-mui-theme@img-arena/ui-core@in2tec/page-editor@react-page-styled/editor@react-page/editor@react-scale/core@react-theming/flatten@musicdr1ven/react-page-editor@muros-ct/plotly.js@jhonpangit/color-full@masterofbob777/helpers@scotthaney323/react-figma@kehila/react-page-editor@kausal/plotly-custom
2.0.2

2 years ago

2.0.1

2 years ago

1.4.3

2 years ago

2.0.0

2 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.8

7 years ago

1.3.7

8 years ago

1.3.6

8 years ago

1.3.5

8 years ago

1.3.4

8 years ago

1.3.3

8 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

11 years ago

1.0.5

11 years ago

1.0.4

11 years ago

1.0.3

11 years ago

1.0.2

11 years ago

1.0.1

11 years ago