omgovich / colord

πŸ‘‘ A tiny yet powerful tool for high-performance color manipulations and conversions
https://colord.omgovich.ru
MIT License
1.67k stars 49 forks source link

New `getFormat` function #44

Closed omgovich closed 3 years ago

omgovich commented 3 years ago

Closes #43

import { getFormat } from 'colord'

getFormat("#000") // "hex"
getFormat("rgba(128, 128, 128, 1)") // "rgb"
getFormat("hsl(180, 50, 50)") // "hsl"
getFormat({ r: 128, g: 128, b: 128, a: 0.5 }) // "rgb"
getFormat({ h: 180, s: 50, l: 50, a: 0.5 }) // "hsl"
getFormat({ h: 180, s: 50, v: 50, a: 0.5 }) // "hsv"
getFormat("red") // "name"
getFormat("disco-dancing") // undefined
getFormat({ w: 1, u: 2, t: 3 }) // undefined
github-actions[bot] commented 3 years ago

Size Change: +93 B (+1%)

Total Size: 8.93 kB

Filename Size Change
./dist/index.js 1.95 kB +54 B (+3%)
./dist/plugins/hwb.js 891 B +4 B (0%)
./dist/plugins/lab.js 1.03 kB +10 B (+1%)
./dist/plugins/lch.js 1.43 kB +7 B (0%)
./dist/plugins/names.js 1.37 kB +7 B (+1%)
./dist/plugins/xyz.js 833 B +11 B (+1%)
ℹ️ View Unchanged | Filename | Size | Change | | :--- | :---: | :---: | | `./dist/plugins/a11y.js` | 459 B | 0 B | | `./dist/plugins/mix.js` | 956 B | 0 B |

compressed-size-action

codecov-commenter commented 3 years ago

Codecov Report

Merging #44 (7ff0054) into master (d4e5e6f) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #44   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           34        34           
  Lines          419       422    +3     
  Branches        72        72           
=========================================
+ Hits           419       422    +3     
Impacted Files Coverage Ξ”
src/colord.ts 100.00% <100.00%> (ΓΈ)
src/index.ts 100.00% <100.00%> (ΓΈ)
src/parse.ts 100.00% <100.00%> (ΓΈ)
src/plugins/hwb.ts 100.00% <100.00%> (ΓΈ)
src/plugins/lab.ts 100.00% <100.00%> (ΓΈ)
src/plugins/lch.ts 100.00% <100.00%> (ΓΈ)
src/plugins/names.ts 100.00% <100.00%> (ΓΈ)
src/plugins/xyz.ts 100.00% <100.00%> (ΓΈ)

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update d4e5e6f...7ff0054. Read the comment docs.