From 50a2a0c85891851d76957129195121717b60a3b5 Mon Sep 17 00:00:00 2001 From: James Brumond Date: Tue, 18 Oct 2022 17:52:55 -0700 Subject: [PATCH] better css color definition --- schemas/color-theme/v1.json | 57 +++++++++++++++++++++++++++++++------ schemas/color-theme/v1.yaml | 55 +++++++++++++++++++++++++++++------ 2 files changed, 96 insertions(+), 16 deletions(-) diff --git a/schemas/color-theme/v1.json b/schemas/color-theme/v1.json index b7b3a25..8b03fe4 100644 --- a/schemas/color-theme/v1.json +++ b/schemas/color-theme/v1.json @@ -5,7 +5,7 @@ "properties": { "name": { "type": "string", - "description": "The name of the color theme as it is displayed in the control panel. Must be unique in any given instance" + "description": "The name of the color theme as it is displayed in web UI. Must match the file\nname of the theme file, e.g. a theme called \"example-theme\" should be located\nin a file called \"example-theme.theme.json\"\n" }, "colors": { "type": "object", @@ -221,13 +221,6 @@ "definitions": { "css_color": { "description": "A valid CSS color value;\nSee https://developer.mozilla.org/en-US/docs/Web/CSS/color_value\n", - "examples": [ - "#000", - "#ff0000", - "#ffccaa88", - "rgb(10, 70, 130)", - "rgba(10, 70, 130, 0.5)" - ], "oneOf": [ { "type": "string", @@ -254,6 +247,54 @@ "examples": [ "rgba(10, 70, 130, 0.5)" ] + }, + { + "type": "string", + "const": "transparent" + }, + { + "type": "string", + "const": "currentcolor" + }, + { + "type": "string", + "enum": [ + "black", + "silver", + "gray", + "white", + "maroon", + "red", + "purple", + "fuchsia", + "green", + "lime", + "olive", + "yellow", + "navy", + "blue", + "teal", + "aqua" + ] + }, + { + "type": "string", + "enum": [ + "orange" + ] + }, + { + "type": "string", + "enum": [ + "aliceblue", + "antiquewhite" + ] + }, + { + "type": "string", + "enum": [ + "rebeccapurple" + ] } ] } diff --git a/schemas/color-theme/v1.yaml b/schemas/color-theme/v1.yaml index 0a2f052..9371892 100644 --- a/schemas/color-theme/v1.yaml +++ b/schemas/color-theme/v1.yaml @@ -4,8 +4,10 @@ type: object properties: name: type: string - description: The name of the color theme as it is displayed in the control - panel. Must be unique in any given instance + description: | + The name of the color theme as it is displayed in web UI. Must match the file + name of the theme file, e.g. a theme called "example-theme" should be located + in a file called "example-theme.theme.json" colors: type: object description: Contains the values that will be used to populate the CSS variables @@ -152,13 +154,8 @@ definitions: description: | A valid CSS color value; See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value - examples: - - "#000" - - "#ff0000" - - "#ffccaa88" - - rgb(10, 70, 130) - - rgba(10, 70, 130, 0.5) oneOf: + # Hex Colors - type: string format: regex pattern: ^(#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3}(?:[0-9a-fA-F]{2})?)?)$ @@ -166,13 +163,55 @@ definitions: - "#000" - "#ff0000" - "#ffccaa88" + # RGB Colors - type: string format: regex pattern: ^(rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\))$ examples: - rgb(10, 70, 130) + # RGBA Colors - type: string format: regex pattern: ^(rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([01]|[01]?\.[0-9]{1,3})\s*\))$ examples: - rgba(10, 70, 130, 0.5) + # transparent + - type: string + const: transparent + # currentcolor + - type: string + const: currentcolor + # Named Colors: CSS Level 1 + - type: string + enum: + - black + - silver + - gray + - white + - maroon + - red + - purple + - fuchsia + - green + - lime + - olive + - yellow + - navy + - blue + - teal + - aqua + # Named Colors: CSS Level 2 + - type: string + enum: + - orange + # Named Colors: CSS Level 3 + - type: string + enum: + - aliceblue + - antiquewhite + # todo: fill in the rest of level3 colors... + # see: https://developer.mozilla.org/en-US/docs/Web/CSS/named-color + # Named Colors: CSS Level 4 + - type: string + enum: + - rebeccapurple