-
Notifications
You must be signed in to change notification settings - Fork 389
brand - warn on invalid color name usage #12537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| /* | ||
| * color-names.ts | ||
| * | ||
| * Copyright (C) 2025 Posit Software, PBC | ||
| */ | ||
|
|
||
| // https://www.w3.org/TR/css-color-3/#svg-color | ||
| export const isCssColorName = (name: string): boolean => { | ||
| if (name.startsWith("#")) return true; | ||
| if (name.startsWith("rgb")) return true; | ||
| if (name.startsWith("hsl")) return true; | ||
| if (name.startsWith("hwb")) return true; | ||
|
|
||
| return [ | ||
| "aliceblue", | ||
| "antiquewhite", | ||
| "aqua", | ||
| "aquamarine", | ||
| "azure", | ||
| "beige", | ||
| "bisque", | ||
| "black", | ||
| "blanchedalmond", | ||
| "blue", | ||
| "blueviolet", | ||
| "brown", | ||
| "burlywood", | ||
| "cadetblue", | ||
| "chartreuse", | ||
| "chocolate", | ||
| "coral", | ||
| "cornflowerblue", | ||
| "cornsilk", | ||
| "crimson", | ||
| "cyan", | ||
| "darkblue", | ||
| "darkcyan", | ||
| "darkgoldenrod", | ||
| "darkgray", | ||
| "darkgreen", | ||
| "darkgrey", | ||
| "darkkhaki", | ||
| "darkmagenta", | ||
| "darkolivegreen", | ||
| "darkorange", | ||
| "darkorchid", | ||
| "darkred", | ||
| "darksalmon", | ||
| "darkseagreen", | ||
| "darkslateblue", | ||
| "darkslategray", | ||
| "darkslategrey", | ||
| "darkturquoise", | ||
| "darkviolet", | ||
| "deeppink", | ||
| "deepskyblue", | ||
| "dimgray", | ||
| "dimgrey", | ||
| "dodgerblue", | ||
| "firebrick", | ||
| "floralwhite", | ||
| "forestgreen", | ||
| "fuchsia", | ||
| "gainsboro", | ||
| "ghostwhite", | ||
| "gold", | ||
| "goldenrod", | ||
| "gray", | ||
| "green", | ||
| "greenyellow", | ||
| "grey", | ||
| "honeydew", | ||
| "hotpink", | ||
| "indianred", | ||
| "indigo", | ||
| "ivory", | ||
| "khaki", | ||
| "lavender", | ||
| "lavenderblush", | ||
| "lawngreen", | ||
| "lemonchiffon", | ||
| "lightblue", | ||
| "lightcoral", | ||
| "lightcyan", | ||
| "lightgoldenrodyellow", | ||
| "lightgray", | ||
| "lightgreen", | ||
| "lightgrey", | ||
| "lightpink", | ||
| "lightsalmon", | ||
| "lightseagreen", | ||
| "lightskyblue", | ||
| "lightslategray", | ||
| "lightslategrey", | ||
| "lightsteelblue", | ||
| "lightyellow", | ||
| "lime", | ||
| "limegreen", | ||
| "linen", | ||
| "magenta", | ||
| "maroon", | ||
| "mediumaquamarine", | ||
| "mediumblue", | ||
| "mediumorchid", | ||
| "mediumpurple", | ||
| "mediumseagreen", | ||
| "mediumslateblue", | ||
| "mediumspringgreen", | ||
| "mediumturquoise", | ||
| "mediumvioletred", | ||
| "midnightblue", | ||
| "mintcream", | ||
| "mistyrose", | ||
| "moccasin", | ||
| "navajowhite", | ||
| "navy", | ||
| "oldlace", | ||
| "olive", | ||
| "olivedrab", | ||
| "orange", | ||
| "orangered", | ||
| "orchid", | ||
| "palegoldenrod", | ||
| "palegreen", | ||
| "paleturquoise", | ||
| "palevioletred", | ||
| "papayawhip", | ||
| "peachpuff", | ||
| "peru", | ||
| "pink", | ||
| "plum", | ||
| "powderblue", | ||
| "purple", | ||
| "red", | ||
| "rosybrown", | ||
| "royalblue", | ||
| "saddlebrown", | ||
| "salmon", | ||
| "sandybrown", | ||
| "seagreen", | ||
| "seashell", | ||
| "sienna", | ||
| "silver", | ||
| "skyblue", | ||
| "slateblue", | ||
| "slategray", | ||
| "slategrey", | ||
| "snow", | ||
| "springgreen", | ||
| "steelblue", | ||
| "tan", | ||
| "teal", | ||
| "thistle", | ||
| "tomato", | ||
| "turquoise", | ||
| "violet", | ||
| "wheat", | ||
| "white", | ||
| "whitesmoke", | ||
| "yellow", | ||
| "yellowgreen", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, looks the same as the named colors in
I see both of us missed |
||
| ].includes(name); | ||
| }; | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| --- | ||
| title: Hello, `_brand.yml`! | ||
| brand: | ||
| typography: | ||
| monospace: | ||
| color: foreground | ||
| format: html | ||
| _quarto: | ||
| tests: | ||
| html: | ||
| noErrors: default | ||
| printsMessage: | ||
| level: WARN | ||
| regex: 'foreground.*valid CSS color name' | ||
| --- | ||
|
|
||
| ## Links | ||
|
|
||
| Download the Positron Beta here: <https://positron.posit.co/download.html> | ||
|
|
||
| Docs for `_brand.yml`: <https://posit-dev.github.io/brand-yml/>, <https://quarto.org/docs/authoring/brand.html> | ||
|
|
||
| ## Placeholder text | ||
|
|
||
| This is an example document with a [number](https://quarto.org) of `features` to help you come with a nicely branded document. | ||
|
|
||
| Duis ornare ex ac iaculis pretium. Maecenas sagittis odio id erat pharetra, sit amet consectetur quam sollicitudin. Vivamus pharetra quam purus, nec sagittis risus pretium at. Nullam feugiat, turpis ac accumsan interdum, sem tellus blandit neque, id vulputate diam quam semper nisl. Donec sit amet enim at neque porttitor aliquet. Phasellus facilisis nulla eget placerat eleifend. Vestibulum non egestas eros, eget lobortis ipsum. Nulla rutrum massa eget enim aliquam, id porttitor erat luctus. Nunc sagittis quis eros eu sagittis. Pellentesque dictum, erat at pellentesque sollicitudin, justo augue pulvinar metus, quis rutrum est mi nec felis. Vestibulum efficitur mi lorem, at elementum purus tincidunt a. Aliquam finibus enim magna, vitae pellentesque erat faucibus at. Nulla mauris tellus, imperdiet id lobortis et, dignissim condimentum ipsum. Morbi nulla orci, varius at aliquet sed, facilisis id tortor. Donec ut urna nisi. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot more color spaces than this, but this should be fine.