From 16d287340a3370767f437a797e5122c57a98c4d2 Mon Sep 17 00:00:00 2001 From: David Barnett Date: Tue, 31 Jan 2023 00:56:19 -0600 Subject: [PATCH] Update schema for [colors] to allow either string or table values --- src/commands/config-schema.json | 82 +++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 18 deletions(-) diff --git a/src/commands/config-schema.json b/src/commands/config-schema.json index 7264770f1..e4dfe3d54 100644 --- a/src/commands/config-schema.json +++ b/src/commands/config-schema.json @@ -99,25 +99,71 @@ }, "colors": { "type": "object", - "description": "Mapping from jj formatter labels to color names", + "description": "Mapping from jj formatter labels to colors", + "definitions": { + "colors": { + "enum": [ + "black", + "red", + "green", + "yellow", + "blue", + "magenta", + "cyan", + "white", + "bright black", + "bright red", + "bright green", + "bright yellow", + "bright blue", + "bright magenta", + "bright cyan", + "bright white" + ] + }, + "basicFormatterLabels": { + "enum": [ + "description", + "change_id", + "commit_id", + "author", + "committer", + "working_copies", + "current_working_copy", + "branches", + "tags", + "git_refs", + "is_git_head", + "divergent", + "conflict" + ] + } + }, + "propertyNames": { + "oneOf": [ + { "$ref": "#/properties/colors/definitions/basicFormatterLabels" }, + { "type": "string" } + ] + }, "additionalProperties": { - "enum": [ - "black", - "red", - "green", - "yellow", - "blue", - "magenta", - "cyan", - "white", - "bright black", - "bright red", - "bright green", - "bright yellow", - "bright blue", - "bright magenta", - "bright cyan", - "bright white" + "description": "A color profile for the given formatter label. Either a bare color name used as the foreground color or a table describing color and formatting", + "oneOf": [ + { + "$ref": "#/properties/colors/definitions/colors" + }, + { + "type": "object", + "properties": { + "fg": { "$ref": "#/properties/colors/definitions/colors" }, + "bg": { "$ref": "#/properties/colors/definitions/colors" }, + "bold": { + "type": "boolean" + }, + "underline": { + "type": "boolean" + } + } + } ] } },