├── .babelrc ├── .gitignore ├── .npmignore ├── .travis.yml ├── README.md ├── compositor.json ├── demo ├── entry.js └── index.html ├── package.json ├── src └── index.js ├── test └── index.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "stage-0", 5 | "react" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | dist 3 | demo/bundle.js 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | 2 | demo 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 6.2 4 | script: 5 | - npm test 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # sploot 3 | 4 | CSS linear-gradient function for creating split backgrounds 5 | 6 | [](https://travis-ci.org/jxnblk/sploot) 7 | 8 |  9 | 10 | ```sh 11 | npm i sploot 12 | ``` 13 | 14 | ```js 15 | import sploot from 'sploot' 16 | 17 | const style = { 18 | backgroundImage: sploot() 19 | } 20 | // 'linear-gradient(180deg, cyan 50%, white 50%)' 21 | ``` 22 | 23 | ```js 24 | // with options 25 | const style = { 26 | backgroundImage: sploot({ 27 | start: 'tomato', 28 | end: 'fuchsia', 29 | position: '25%', 30 | angle: 90 31 | }) 32 | } 33 | ``` 34 | 35 | MIT License 36 | 37 | -------------------------------------------------------------------------------- /compositor.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jxnblk/sploot", 3 | "version": "0.1.4", 4 | "libraries": { 5 | "xv": "^1.1.19" 6 | }, 7 | "title": "Sploot", 8 | "branch": "", 9 | "style": { 10 | "name": "Default", 11 | "componentSet": { 12 | "nav": "nav/BasicNav", 13 | "header": "header/BannerHeader", 14 | "article": "article/BasicArticle", 15 | "footer": "footer/BasicFooter" 16 | }, 17 | "fontFamily": "-apple-system, BlinkMacSystemFont, sans-serif", 18 | "fontWeight": 400, 19 | "bold": 600, 20 | "lineHeight": 1.5, 21 | "typeScale": [ 22 | 72, 23 | 48, 24 | 24, 25 | 20, 26 | 16, 27 | 14, 28 | 12 29 | ], 30 | "monospace": "Menlo, monospace", 31 | "heading": { 32 | "fontFamily": null, 33 | "fontStyle": null, 34 | "fontWeight": 600, 35 | "lineHeight": 1.25, 36 | "textTransform": null, 37 | "letterSpacing": null, 38 | "h0": {}, 39 | "h1": {}, 40 | "h2": {}, 41 | "h3": {}, 42 | "h4": {}, 43 | "h5": {}, 44 | "h6": {} 45 | }, 46 | "alternativeText": {}, 47 | "space": [ 48 | 0, 49 | 8, 50 | 16, 51 | 32, 52 | 48, 53 | 64, 54 | 96 55 | ], 56 | "layout": { 57 | "maxWidth": 1024, 58 | "centered": false 59 | }, 60 | "colors": { 61 | "text": "#111", 62 | "background": "#fff", 63 | "primary": "#08e", 64 | "secondary": "#059", 65 | "highlight": "#e08", 66 | "border": "#ddd", 67 | "muted": "#eee" 68 | }, 69 | "border": { 70 | "width": 1, 71 | "radius": 2 72 | }, 73 | "link": {}, 74 | "button": { 75 | "hover": { 76 | "boxShadow": "inset 0 0 0 999px rgba(0, 0, 0, .125)" 77 | } 78 | }, 79 | "input": {}, 80 | "body": { 81 | "margin": 0 82 | }, 83 | "breakpoints": { 84 | "xs": "@media screen and (max-width:40em)", 85 | "sm": "@media screen and (min-width:40em)", 86 | "md": "@media screen and (min-width:52em)", 87 | "lg": "@media screen and (min-width:64em)" 88 | } 89 | }, 90 | "content": [ 91 | { 92 | "component": "nav", 93 | "links": [ 94 | { 95 | "href": "http://jxnblk.com/sploot", 96 | "text": "Home" 97 | }, 98 | { 99 | "href": "https://github.com/jxnblk/sploot", 100 | "text": "GitHub" 101 | }, 102 | { 103 | "href": "https://npmjs.com/package/sploot", 104 | "text": "npm" 105 | } 106 | ] 107 | }, 108 | { 109 | "component": "header", 110 | "heading": "sploot", 111 | "subhead": "CSS linear-gradient function for creating split backgrounds", 112 | "children": [ 113 | { 114 | "component": "ui/TweetButton", 115 | "text": "sploot: CSS linear-gradient function for creating split backgrounds", 116 | "url": "http://jxnblk.com/sploot" 117 | }, 118 | { 119 | "component": "ui/GithubButton", 120 | "user": "jxnblk", 121 | "repo": "sploot" 122 | } 123 | ], 124 | "text": "v1.0.0", 125 | "backgroundImage": "https://hd.unsplash.com/photo-1455380579765-810023662ea2" 126 | }, 127 | { 128 | "component": "article", 129 | "metadata": { 130 | "source": "github.readme" 131 | }, 132 | "html": "\n\n
\n\nnpm i sploot
import sploot from 'sploot'\n\nconst style = {\n backgroundImage: sploot()\n}\n// 'linear-gradient(180deg, cyan 50%, white 50%)'
// with options\nconst style = {\n backgroundImage: sploot({\n start: 'tomato',\n end: 'fuchsia',\n position: '25%',\n angle: 90\n })\n}
MIT License
\n" 133 | }, 134 | { 135 | "component": "footer", 136 | "links": [ 137 | { 138 | "href": "https://github.com/jxnblk/sploot", 139 | "text": "GitHub" 140 | }, 141 | { 142 | "href": "https://github.com/jxnblk", 143 | "text": "jxnblk" 144 | } 145 | ] 146 | } 147 | ] 148 | } -------------------------------------------------------------------------------- /demo/entry.js: -------------------------------------------------------------------------------- 1 | 2 | import React from 'react' 3 | import ReactDOM from 'react-dom' 4 | import sploot from '../src' 5 | 6 | const Sploot = ({ 7 | color, 8 | position, 9 | angle, 10 | ...props 11 | }) => { 12 | const sx = { 13 | margin: 32, 14 | padding: 32, 15 | backgroundImage: sploot({ 16 | start: color, 17 | position, 18 | angle 19 | }) 20 | } 21 | 22 | return ( 23 | 24 | ) 25 | } 26 | 27 | const App = () => { 28 | return ( 29 |CSS linear-gradient function for creating split backgrounds
33 | GitHub 34 | {' '} 35 | npm 36 |