Add support for rgb, rgba, hsl, hsla, css named colors (#1635)

* add support for rgb, rgb, css named colors

* add support for hsl, hsla & add color-validate

* update makeBadge test, better coverage

* re-add comment

* add comment for supported colors

* dynamic badge gen, remove 'hex'

* add support for 1.0 opacity & fix 101-109

* fix colorscheme tests

* remove extra tests

* add test for negative values

* add test for uppercase & mixed case colors

* fix mixed case/uppercase test

* allow whitespace around color

* update test error messages

* add comments

* add more uppercase test

* update error message

* default to grey/red if invalid color chosen

default colorscheme:
colorA: grey
colorB: red

* Revert "default to grey/red if invalid color chosen"

This reverts commit 10db0c6d74.
Reverted as this affects the CLI version/when no color specified.

* validColor -> isCSSColor

* assignColor function

* update tests to use sazerac
This commit is contained in:
Danial
2018-07-12 10:26:17 +12:00
committed by GitHub
parent 9ca74740fa
commit d8cf836264
9 changed files with 112 additions and 60 deletions

View File

@@ -64,7 +64,7 @@ export default class DynamicBadgeMaker extends React.Component {
className="short"
value={this.state.color}
onChange={event => this.setState({ color: event.target.value })}
placeholder="hex color" /> {}
placeholder="color" /> {}
<input
className="short"
value={this.state.prefix}

View File

@@ -190,13 +190,13 @@ export default class Usage extends React.PureComponent {
<td>
<code>?colorA=abcdef</code>
</td>
<td>Set background of the left part (hex color only)</td>
<td>Set background of the left part (hex, rgb, rgba, hsl, hsla and css named colors supported)</td>
</tr>
<tr>
<td>
<code>?colorB=fedcba</code>
</td>
<td>Set background of the right part (hex color only)</td>
<td>Set background of the right part (hex, rgb, rgba, hsl, hsla and css named colors supported)</td>
</tr>
<tr>
<td>