Skip to content

Commit

Permalink
Merge pull request #3 from timhettler/feat/v2
Browse files Browse the repository at this point in the history
feat: v2
  • Loading branch information
timhettler committed Jan 26, 2023
2 parents 162a3cf + f960c15 commit 42ed6fe
Show file tree
Hide file tree
Showing 65 changed files with 9,745 additions and 787 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]

jobs:
build:
name: Smoke Tests
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
cache: "yarn"

- name: Install dependencies
run: yarn

- name: Lint
run: yarn lint

- name: Generate Docs
run: yarn generate
45 changes: 11 additions & 34 deletions .gitignore
@@ -1,42 +1,19 @@
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
*.sass-cache
*.iml
*.gem
.bundle
*.lock

# Package folders
node_modules
bower_components

# OS or Editor folders
.DS_Store
Thumbs.db
.cache
.project
.settings
.tmproj
.gitconfig
*.esproj
nbproject
*.sublime-project
*.sublime-workspace
*.pem

# Folders to ignore
.hg
.svn
.CVS
intermediate
publish
.idea
build
test/output
test/output

# yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn test
9 changes: 9 additions & 0 deletions .prettierignore
@@ -0,0 +1,9 @@
!.*
.git/
.vscode/
.yarn/
.yarnrc
demo/
sassdoc/
node_modules/
**/*.scss
47 changes: 47 additions & 0 deletions .stylelintrc.yml
@@ -0,0 +1,47 @@
# See https://stylelint.io/user-guide/rules/list
# Also https://github.com/kristerkari/stylelint-scss#list-of-rules

extends:
- stylelint-config-standard-scss
- stylelint-prettier/recommended
plugins:
- stylelint-prettier

ignoreFiles:
- "test/**/*.*"

rules:
# Default rules:
# - https://github.com/stylelint-scss/stylelint-config-standard-scss/blob/main/index.js
# - https://github.com/stylelint-scss/stylelint-config-recommended-scss/blob/master/index.js
# - https://github.com/stylelint/stylelint-config-standard/blob/main/index.js
# - https://github.com/stylelint/stylelint-config-recommended/blob/main/index.js
# - https://github.com/prettier/stylelint-config-prettier/blob/master/src/index.js

# Sass
scss/at-function-pattern:
- "^([_|-]*[a-z][a-z0-9]*)(-[a-z0-9]+)*-*$"
- message: "Expected function to be kebab-case"
scss/at-mixin-pattern:
- "^([_|-]*[a-z][a-z0-9]*)(-[a-z0-9]+)*-*$"
- message: "Expected mixin to be kebab-case"
scss/at-rule-conditional-no-parentheses: null
scss/dollar-variable-pattern:
- "^([_|-]*[a-z][a-z0-9]*)(-[a-z0-9]+)*-*$"
- message: "Expected variable to be kebab-case"

# Disable for Prettier
scss/at-else-closing-brace-newline-after: null
scss/at-else-closing-brace-space-after: null
scss/at-else-empty-line-before: null
scss/at-else-if-parentheses-space-before: null
scss/at-function-parentheses-space-before: null
scss/at-if-closing-brace-newline-after: null
scss/at-if-closing-brace-space-after: null
scss/at-mixin-parentheses-space-before: null
scss/dollar-variable-colon-newline-after: null
scss/dollar-variable-colon-space-after: null
scss/dollar-variable-colon-space-before: null
scss/operator-no-newline-after: null
scss/operator-no-newline-before: null
scss/operator-no-unspaced: null
823 changes: 823 additions & 0 deletions .yarn/releases/yarn-3.3.1.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
@@ -0,0 +1,2 @@
yarnPath: .yarn/releases/yarn-3.3.1.cjs
nodeLinker: node-modules
13 changes: 13 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,13 @@
# Sass YIQ CHANGELOG

## 2.0.0 (01/25/22)

- BREAKING: Package name is now scoped: `@timhettler/sass-yiq`
- BREAKING: Switch to Dart Sass with Sass module system, dropping support for Node Sass.
- BREAKING: Move `sass` to `peerDependencies`.
- BREAKING: Drop `yiq-` from variable, module, and function names. Projects not using Sass modules can still `@import '<path>/@timhettler/sass-yiq/sass/yiq'` to access the former names.
- BREAKING: Removed Bower support.
- BREAKING: Removed Sache support.
- FEATURE: Added `\_index.scss` at the project root, for simpler import path: @use '<path>/@timhettler/sass-yiq'
- INTERNAL: Remove Grunt(!)
- INTERNAL: Update dev dependencies and package manager
3 changes: 0 additions & 3 deletions Gemfile

This file was deleted.

53 changes: 0 additions & 53 deletions Gruntfile.js

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy
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 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.
40 changes: 18 additions & 22 deletions README.md
@@ -1,37 +1,33 @@
# YIQ Color Contrast

The obvious way to determe whether a color is "light" or "dark" by checking the lightness value in the HSL color space. this approach works sometimes, but often produces color pairings that - while technically correct - just look a little "off". The reason for this is that the eye is more sensitive to changes in the orange-blue range than in the purple-green range, so the percieved lightness of a color can change depending its wavelength.
Most approaches to checking color contrast use the HSL color space. This often produces color pairings that - while technically correct - look just a little "off". The reason for this is that the eye is more sensitive to changes in the orange-blue range than in the purple-green range, so the percieved lightness of a color can change depending its wavelength.

The YIQ color space is designed to take this bias into account. It weighs the different parts of the color according to their impact on our perpection of the color's brightness. By utilizing this color space when doing contrast comparison, the result is a color pairing that appears more natural.
The YIQ color space is designed to take this bias into account. It weighs the different parts of the color according to their impact on our perpection of the color's brightness. Color pairings appear more natural when utilizing this color space for contrast comparisons.

For information on color contrast and the YIQ color space:

* [**24 Ways:** Calculating Color Contrast](http://24ways.org/2010/calculating-color-contrast/)
* [**W3C:** Ensure that foreground and background color combinations provide sufficient contrast when viewed by someone having color deficits or when viewed on a black and white screen](http://www.w3.org/TR/AERT#color-contrast)
* [**Wikipedia:** YIQ](http://en.wikipedia.org/wiki/YIQ)
- [**24 Ways:** Calculating Color Contrast](http://24ways.org/2010/calculating-color-contrast/)
- [**W3C:** Ensure that foreground and background color combinations provide sufficient contrast when viewed by someone having color deficits or when viewed on a black and white screen](http://www.w3.org/TR/AERT#color-contrast)
- [**Wikipedia:** YIQ](http://en.wikipedia.org/wiki/YIQ)

## Installation options
## Demo

### NPM
Compare YIQ color contrast to HSL color contrast: http://timhettler.github.io/sass-yiq/demo/

```
npm install sass-yiq
```
## Installation

### Bower

```
bower install sass-yiq
```
```
yarn add @timhettler/sass-yiq
```

## Usage & Configuration

```scss
@import 'sass-yiq'
```

Details on available variables, functions, and mixins can be found in the [SassDoc documentation](http://timhettler.github.io/sass-yiq/sassdoc)
```scss
@use "@timhettler/sass-yiq" as yiq;

### Demo
.container {
@include yiq.contrasted(#fa5400, #000, #fff);
}
```

Check out how the YIQ color contrast compares to HSL color contrast: http://timhettler.github.io/sass-yiq/demo/
Details on available variables, functions, and mixins can be found in the [SassDoc documentation](http://timhettler.github.io/sass-yiq/sassdoc)
1 change: 1 addition & 0 deletions _index.scss
@@ -0,0 +1 @@
@forward "sass/yiq";
24 changes: 0 additions & 24 deletions bower.json

This file was deleted.

0 comments on commit 42ed6fe

Please sign in to comment.