ierhyna / stylelint-no-indistinguishable-colors Goto Github PK
View Code? Open in Web Editor NEWStylelint plugin to add rule no-indistinguishable-colors
Stylelint plugin to add rule no-indistinguishable-colors
First of all thanks a lot for your great plugin.
I'd like to suggest to evaluate whether its possible to update to the newest PostCSS version, as it might be beneficial to update the earlier the better to avoid later, bigger migration steps, compare to https://github.com/postcss/postcss/blob/main/CHANGELOG.md
Please, allow passing false
to plugin/stylelint-no-indistinguishable-colors
rule to temporarily disable the plugin without removing the rule completely. This would allow for quick switching on and off during colors or during trying out new color combinations
In the latest version, 1.3.2, this package only lists 11, 12, 13 in peer dependencies. Can you create a release with the support for v14? I see the changes to support v14 were made 20 days ago, but they were never published in a new release.
I have one color which is rgba(0, 0, 0, 0.25)
and one which is rgba(0,0,0, 0.75)
.
If it's used as foreground color, and the background is white, their visual appearance is totally different, but the plugin complains:
Unexpected indistinguishable colors "rgba(0, 0, 0, 0.25)" and "rgba(0, 0, 0, 0.75)".
The problem is, that the colorguard
library you are using, does not considers alpha values.
(from their documentation):
Currently, alpha transparency is just stripped from the colors. So
rgb(0, 0, 0)
exactly matchesrgba(0,0,0,0.5)
.
If they are stripped of, they should be ignored at all, and not being shown as different.
I have this variable:
$shadow-box: 2px 2px 5px 1px $color-transparent-black;
That's what I receive as a warning:
client/scss/_variables.scss
55:1 ✖ Unexpected indistinguishable plugin/stylelint-no-indistinguishable-colors
colors "black" and "rgb(0, 0,
0)".
Since version 2.0.0, the following code:
font-family: Helvetica, "Arial Black", sans-serif;
Will cause Circular reference error with the following stacktrace:
at <input css RJ9aru>:72:5
at x (/[email protected]/node_modules/colorguard-processor/dist/index.js:36:3395)
at h (/[email protected]/node_modules/colorguard-processor/dist/index.js:36:2744)
at u (/[email protected]/node_modules/colorguard-processor/dist/index.js:37:222)
at /[email protected]/node_modules/colorguard-processor/dist/index.js:37:842
at Array.forEach (<anonymous>)
at /[email protected]/node_modules/colorguard-processor/dist/index.js:37:772
at Array.forEach (<anonymous>)
at /[email protected]/node_modules/colorguard-processor/dist/index.js:37:634
at /[email protected]/node_modules/postcss/lib/container.js:345:18
at /[email protected]/node_modules/postcss/lib/container.js:297:18
Seems somehow it recognises color names in font family names and result into errors.
This error was not present in v1.3.2.
Right now, npm throws a warning:
[email protected] requires a peer of stylelint@^11.1.1 but none is installed. You must install peer dependencies yourself.
Currently, stylelint 13.0.0 is the latest version.
I'm using:
"stylelint": "13.0.0",
"stylelint-no-indistinguishable-colors": "1.3.0",
Somewhat similar to #4, this plugin (which is great btw) is throwing a warning for the following code:
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12);
While I do want this warning when using those colors normally, in the case of custom shadows I think it's fairly common to have various shades that are quite similar.
It would be great to have an option to ignore box-shadows. (I could always move this code to a variable if #4 is solved first)
I am facing this error with this file:
$color-white: rgb(255, 255, 255);
:export {
// Error here:
$var-color-white: $color-white;
}
Error text:
client/scss/_variables.scss
5:3 ✖ Unexpected indistinguishable plugin/stylelint-no-indistinguishable-colors
colors "white" and "rgb(255, 255, 255)".
Full setup: https://github.com/wemake-services/wemake-frontend-styleguide/tree/master/packages/stylelint-config-scss
Stylelint 16 removed isValidHex
, as can be seen here:
stylelint/stylelint#7248
This means https://github.com/ierhyna/stylelint-no-indistinguishable-colors is incompatible with stylelint 16
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.