Skip to content

Commit

Permalink
v0.1.0-beta.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mirisuzanne committed Oct 10, 2019
1 parent 2a6ace6 commit 8286a7c
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 81 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 0.1.0-beta.7 - 2019/10/9

- BREAKING: rename `[data-ccs="*-select"]` attributes
with nested form inputs to
`[data-ccs-field="*"]` and nested `[data-ccs-input="*"]`
- BREAKING: rename `[data-ccs="unset"]` to `[data-ccs-input="unset"]`
- BREAKING: rename `[data-ccs="invert"]` to `[data-ccs-input="mode"]`
- Use [Hipocratic License](https://firstdonoharm.dev/)
- Add root-level `_index.scss` for simpler Sass imports

## 0.1.0-beta.6 - 2019/10/6

- More organized Sass files
Expand Down
26 changes: 19 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
MIT License
Hippocratic License

Copyright (c) 2019 Miriam Suzanne

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
of this software and associated documentation files (the Software), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* The Software may not be used by individuals, corporations, governments, or
other groups for systems or activities that actively and knowingly endanger,
harm, or otherwise threaten the physical, mental, economic, or general
well-being of individuals or groups in violation of the United Nations
Universal Declaration of Human Rights
(https://www.un.org/en/universal-declaration-human-rights/).


THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

This license is derived from the MIT License, as amended to limit the impact
of the unethical use of open source software.

32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ using the `[data-ccs-theme]` attribute:
[data-ccs-theme='adjacent'] {
/* adjacent logic */
}

[data-ccs-theme='contrast'] {
--ccs-contrast: 200%; /* override all other contrast settings */
--ccs-custom-contrast: none; /* hide [data-ccs="contrast-select"] */
}
```

### Sass Configuration
Expand Down Expand Up @@ -273,18 +268,31 @@ We provide several hooks for the JS to use
- `[data-ccs="menu"]`:
if you hide the settings by default,
we'll show them when the JS is available
- `[data-ccs="invert"]`:
- `[data-ccs-input="mode"]`:
a button to toggle light/dark modes
- `[data-ccs="unset"]`:
- `[data-ccs-input="unset"]`:
a button to unset all user preferences
and clear related local storage
- `[data-ccs="theme-select"] select`:
- `[data-ccs-input="theme"]`:
Allow users to select from available `theme` options
- `[data-ccs="hue-select"] input`:
- `[data-ccs-input="hue"]`:
Allow users to change the primary hue
- `[data-ccs="saturation-select"] input`:
- `[data-ccs-input="saturation"]`:
Allow users to adjust the baseline saturation
- `[data-ccs="lightness-select"] input`:
- `[data-ccs-input="lightness"]`:
Allow users to adjust the baseline lightness
- `[data-ccs="contrast-select"] input`:
- `[data-ccs-input="contrast"]`:
Allow users to adjust the contrast range

Themes can also use the `[data-ccs-field]` on wrappers,
to show and hide inputs/labels directly in the CSS
based on a given theme.
For example, a high-contrast theme
might not accept `contrast` input:

```scss
[data-ccs-theme='contrast'] {
--ccs-contrast: 200%; /* override all other contrast settings */
--ccs-custom-contrast: none; /* hide [data-ccs-field="contrast"] */
}
```
1 change: 1 addition & 0 deletions _index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@forward 'sass/ccs';
12 changes: 8 additions & 4 deletions css/ccs.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/ccs.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
// elements
const root = document.querySelector('[data-ccs="root"]');
const themeMenu = document.querySelector('[data-ccs="menu"]');
const modeToggle = document.querySelector('[data-ccs="invert"]');
const unsetBtn = document.querySelector('[data-ccs="unset"]'); // elements
const modeToggle = document.querySelector('[data-ccs-input="mode"]');
const unsetBtn = document.querySelector('[data-ccs-input="unset"]'); // elements

const selectElements = {
theme: document.querySelector('[data-ccs="theme-select"] select'),
hue: document.querySelector('[data-ccs="hue-select"] input'),
sat: document.querySelector('[data-ccs="saturation-select"] input'),
light: document.querySelector('[data-ccs="lightness-select"] input'),
contrast: document.querySelector('[data-ccs="contrast-select"] input')
theme: document.querySelector('[data-ccs-input="theme"]'),
hue: document.querySelector('[data-ccs-input="hue"]'),
sat: document.querySelector('[data-ccs-input="saturation"]'),
light: document.querySelector('[data-ccs-input="lightness"]'),
contrast: document.querySelector('[data-ccs-input="contrast"]')
}; // attributes

const attrs = {
Expand Down
24 changes: 12 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ <h1><a href="https://cascading-colors.netlify.com/" rel="home">Cascading Color S
<menu data-ccs="menu">
<div class="color-btns">
<button
data-ccs="invert"
data-ccs-input="mode"
type="button">
invert
</button>
<button
data-ccs="unset"
data-ccs-input="unset"
type="button"
hidden>
reset
</button>
</div>

<div class="color-fields">
<label data-ccs="theme-select" for="ccs-theme-select">
<label for="theme" data-ccs-field="theme">
<span data-label>theme:</span>
<select name="ccs-theme-select" id="ccs-theme-select">
<select name="theme" id="theme" data-ccs-input="theme">
<option value="default">
default
</option>
Expand All @@ -68,21 +68,21 @@ <h1><a href="https://cascading-colors.netlify.com/" rel="home">Cascading Color S
</option>
</select>
</label>
<label data-ccs="hue-select" for="ccs-hue-select">
<label data-ccs-field="hue" for="hue">
<span data-label>hue:</span>
<input id="ccs-hue-select" type="range" min="0" max="360" value="330">
<input id="hue" type="range" min="0" max="360" value="330" data-ccs-input="hue">
</label>
<label data-ccs="saturation-select" for="ccs-saturation-select">
<label data-ccs-field="saturation" for="saturation">
<span data-label>saturation:</span>
<input id="ccs-saturation-select" type="range" min="0" max="100" value="50">
<input id="saturation" type="range" min="0" max="100" value="50" data-ccs-input="saturation">
</label>
<label data-ccs="lightness-select" for="ccs-lightness-select">
<label data-ccs-field="lightness" for="lightness">
<span data-label>lightness:</span>
<input id="ccs-lightness-select" type="range" min="25" max="75" value="50">
<input id="lightness" type="range" min="25" max="75" value="50" data-ccs-input="lightness">
</label>
<label data-ccs="contrast-select" for="ccs-contrast-select">
<label data-ccs-field="contrast" for="contrast">
<span data-label>contrast:</span>
<input id="ccs-contrast-select" type="range" min="15" max="150" value="45">
<input id="contrast" type="range" min="15" max="150" value="45" data-ccs-input="contrast">
</label>
</div>
</menu>
Expand Down
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ export default function () {
// elements
const root = document.querySelector('[data-ccs="root"]');
const themeMenu = document.querySelector('[data-ccs="menu"]');
const modeToggle = document.querySelector('[data-ccs="invert"]');
const unsetBtn = document.querySelector('[data-ccs="unset"]');
const modeToggle = document.querySelector('[data-ccs-input="mode"]');
const unsetBtn = document.querySelector('[data-ccs-input="unset"]');

// elements
const selectElements = {
theme: document.querySelector('[data-ccs="theme-select"] select'),
hue: document.querySelector('[data-ccs="hue-select"] input'),
sat: document.querySelector('[data-ccs="saturation-select"] input'),
light: document.querySelector('[data-ccs="lightness-select"] input'),
contrast: document.querySelector('[data-ccs="contrast-select"] input'),
theme: document.querySelector('[data-ccs-input="theme"]'),
hue: document.querySelector('[data-ccs-input="hue"]'),
sat: document.querySelector('[data-ccs-input="saturation"]'),
light: document.querySelector('[data-ccs-input="lightness"]'),
contrast: document.querySelector('[data-ccs-input="contrast"]'),
};

// attributes
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cascading-color-systems",
"version": "0.1.0-beta.6",
"version": "0.1.0-beta.7",
"description": "generate dynamic color palettes with custom properties",
"main": "dist.js",
"module": "index.js",
Expand All @@ -10,7 +10,7 @@
"contributors": [
"Jonny Gerig Meyer <jonny@oddbird.net>"
],
"license": "MIT",
"license": "MIT Hippocratic",

This comment has been minimized.

Copy link
@jgerigmeyer

jgerigmeyer Oct 10, 2019

Member

Not a big deal, but I think technically according to the package.json schema this is not a valid license choice. Should be "license" : "SEE LICENSE IN LICENSE", (or could add .txt to the file to make it clearer).

https://docs.npmjs.com/files/package.json#license

This comment has been minimized.

Copy link
@mirisuzanne

mirisuzanne Oct 10, 2019

Author Member

oh I read that and interpreted "a string value like this one" to mean any string value - but your reading makes sense. We can change that.

"devDependencies": {
"@babel/cli": "^7.6.2",
"@babel/core": "^7.6.2",
Expand All @@ -27,7 +27,7 @@
"build-site": "sass site/sass/styles.scss site/css/styles.css",
"build": "yarn build-sass && yarn build-docs && yarn build-js && yarn build-site",
"commit": "yarn build",
"watch": "sass --watch site/sass/* site/css/*"
"watch": "sass --watch site/sass/:site/css/"
},
"files": [
"css/**/*.css",
Expand Down
12 changes: 8 additions & 4 deletions sass/partials/_menu.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
[data-ccs='hue-select'] {
[data-ccs-field='hue'] {
display: var(--ccs-custom-hue, block);
}

[data-ccs='lightness-select'] {
[data-ccs-field='hue'] {
display: var(--ccs-custom-hue, block);
}

[data-ccs-field='lightness'] {
display: var(--ccs-custom-lightness, block);
}

[data-ccs='saturation-select'] {
[data-ccs-field='saturation'] {
display: var(--ccs-custom-saturation, block);
}

[data-ccs='contrast-select'] {
[data-ccs-field='contrast'] {
display: var(--ccs-custom-contrast, block);
}
38 changes: 21 additions & 17 deletions site/css/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8286a7c

Please sign in to comment.