-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inline color: Support for (semi-)transparent colors and minor improve…
…ments (#2223) - This changes the inline preview to include a background image, so (semi-)transparent colors can be identified as such instead of blending with the background color of the current theme. - The black outline is now more transparent to better blend in with light themes. - The `transparent` color was added to CSS Extras. - This fixes the `parseHexColor` function.
- Loading branch information
1 parent
bf4f7bf
commit 8d2c5a3
Showing
6 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
span.inline-color { | ||
span.inline-color-wrapper { | ||
/* | ||
* The background image is the following SVG inline in base 64: | ||
* | ||
* <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"> | ||
* <path fill="gray" d="M0 0h2v2H0z"/> | ||
* <path fill="white" d="M0 0h1v1H0zM1 1h1v1H1z"/> | ||
* </svg> | ||
* | ||
* SVG-inlining explained: | ||
* https://stackoverflow.com/a/21626701/7595472 | ||
*/ | ||
background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyIDIiPjxwYXRoIGZpbGw9ImdyYXkiIGQ9Ik0wIDBoMnYySDB6Ii8+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0wIDBoMXYxSDB6TTEgMWgxdjFIMXoiLz48L3N2Zz4="); | ||
/* This is to prevent visual glitches where one pixel from the repeating pattern could be seen. */ | ||
background-position: center; | ||
background-size: 110%; | ||
|
||
display: inline-block; | ||
height: 1.333ch; | ||
width: 1.333ch; | ||
margin: 0 .333ch; | ||
box-sizing: border-box; | ||
border: 1px solid white; | ||
outline: 1px solid black; | ||
outline: 1px solid rgba(0,0,0,.5); | ||
overflow: hidden; | ||
} | ||
|
||
span.inline-color { | ||
display: block; | ||
/* To prevent visual glitches again */ | ||
height: 120%; | ||
width: 120%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.