2.0.2 • Published 1 year ago

color-parse v2.0.2

Weekly downloads
152,179
License
MIT
Repository
github
Last release
1 year 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-map@craftedsro/react-page-editor@concrete-design/core@blankparenthesis/pxlsspace@react-page-styled/editor@react-page/editortint-n-tinge@assembless/tint-n-tinge@ckd/vue-button@ckeditor/ckeditor5-ui@a-type/ui@dhilt/plotly.js@crunchr/plotly.js@easyv/utils@habx/ui-core@hoangho1147/hoang-sankey-plotly@heyform-inc/embed@hfribeiro/ska-plotly@hussam-001/react-page-editor@hussam-001/editor@idea-ionic/agenda@finos/legend-art@giliweb/plotly.js@giangtong/plotly.js@infinitebrahmanuniverse/nolb-color-@lona/workspace-to-sketch-library@muros-ct/plotly.js@musicdr1ven/react-page-editor@masterofbob777/helpers@newcrom/plotly.js@fabwcie/ckeditor5-preview@kausal/plotly-custom@kehila/react-page-editor@img-arena/img-ui-mui-theme@img-arena/ui-core@in2tec/page-editor@jhonpangit/color-full@react-theming/flatten@react-scale/core@nuggxyz/dotnugg-sdk@northernlight/react-page-editor@springmicro/page@shapething/shacl-rendererp5nodejsnw-discord.js-commandoocmapreactxp-shadowreact-figmapengubinplotly.jsplotly.js-esmplotly.js-cartesian-esmplotly.js-fix2posthtml-transformpostcss-blurry-gradient-workaroundprime-graphicsgl-spectrogramgl-spectrum@zalastax/nolb-color-@zhigang1992/react-native-shadow-viewabobaker-editorained-ckeditor5csnfcustom-plotly.jscolor-rgbacolor-alphacolor2color-interpolatecolor-compositechannel-colorsexpect-colorhotpay-custom-componentsguest-chat-uimaterial-nativelmdb-indexkpmp-custom-plotly.js@useaward/embed@uoa-eresearch/plotly.js@timeax/valetautoman-runnerfe-utilf2c-server
2.0.2

1 year ago

2.0.1

1 year 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

6 years ago

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

8 years ago

1.3.4

8 years ago

1.3.3

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago