aboutsummaryrefslogtreecommitdiff
path: root/node_modules/color-string/README.md
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/color-string/README.md
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/color-string/README.md')
-rw-r--r--node_modules/color-string/README.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/node_modules/color-string/README.md b/node_modules/color-string/README.md
new file mode 100644
index 00000000..bca726dd
--- /dev/null
+++ b/node_modules/color-string/README.md
@@ -0,0 +1,36 @@
+# color-string
+color-string is a library for parsing and generating CSS color strings.
+
+#### parsing:
+```javascript
+colorString.getRgb("#FFF") // [255, 255, 255]
+colorString.getRgb("blue") // [0, 0, 255]
+
+colorString.getRgba("rgba(200, 60, 60, 0.3)") // [200, 60, 60, 0.3]
+colorString.getRgba("rgb(200, 200, 200)") // [200, 200, 200, 1]
+
+colorString.getHsl("hsl(360, 100%, 50%)") // [360, 100, 50]
+colorString.getHsla("hsla(360, 60%, 50%, 0.4)") // [360, 60, 50, 0.4]
+
+colorString.getAlpha("rgba(200, 0, 12, 0.6)") // 0.6
+```
+#### generating:
+```javascript
+colorString.hexString([255, 255, 255]) // "#FFFFFF"
+colorString.rgbString([255, 255, 255]) // "rgb(255, 255, 255)"
+colorString.rgbString([0, 0, 255, 0.4]) // "rgba(0, 0, 255, 0.4)"
+colorString.rgbString([0, 0, 255], 0.4) // "rgba(0, 0, 255, 0.4)"
+colorString.percentString([0, 0, 255]) // "rgb(0%, 0%, 100%)"
+colorString.keyword([255, 255, 0]) // "yellow"
+colorString.hslString([360, 100, 100]) // "hsl(360, 100%, 100%)"
+```
+
+# Install
+
+### node
+For [node](http://nodejs.org) with [npm](http://npmjs.org):
+
+ npm install color-string
+
+### browser
+Download the latest [color-string.js](https://github.com/harthur/color-string/tree/gh-pages). The `colorString` object is exported.