You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2026/09/14 13:48:43 UTC

(juneau) branch master updated: Add Theme.LIGHT_RED, a light-chrome red sibling of LIGHT_BROWN that keeps OPEN's semantic status/tag tokens (WORK-R0009).

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 17aaa51315 Add Theme.LIGHT_RED, a light-chrome red sibling of LIGHT_BROWN that keeps OPEN's semantic status/tag tokens (WORK-R0009).
17aaa51315 is described below

commit 17aaa51315fa9e419c7bd2641d5774454eccd023
Author: James Bognar <ja...@apache.org>
AuthorDate: Mon Sep 14 09:48:37 2026 -0400

    Add Theme.LIGHT_RED, a light-chrome red sibling of LIGHT_BROWN that keeps OPEN's semantic status/tag tokens (WORK-R0009).
---
 .../rest/server/console/ConsoleChromeMixin.java    |  4 +-
 .../apache/juneau/rest/server/console/Theme.java   | 41 +++++++++++
 .../server/console/ConsoleChromeMixin_Test.java    |  8 +--
 .../rest/server/console/Theme_LightRed_Test.java   | 82 ++++++++++++++++++++++
 4 files changed, 129 insertions(+), 6 deletions(-)

diff --git a/juneau-rest/juneau-rest-server-console-ui/src/main/java/org/apache/juneau/rest/server/console/ConsoleChromeMixin.java b/juneau-rest/juneau-rest-server-console-ui/src/main/java/org/apache/juneau/rest/server/console/ConsoleChromeMixin.java
index 6dad28c8cf..3463c69753 100644
--- a/juneau-rest/juneau-rest-server-console-ui/src/main/java/org/apache/juneau/rest/server/console/ConsoleChromeMixin.java
+++ b/juneau-rest/juneau-rest-server-console-ui/src/main/java/org/apache/juneau/rest/server/console/ConsoleChromeMixin.java
@@ -193,8 +193,8 @@ public class ConsoleChromeMixin {
 	 * <p>
 	 * {@code --jc-header-bg} (and, transitively, {@code --jc-nav-bg}) derives from {@code --jc-chrome-bg}, not
 	 * {@code --jc-surface}: the header/nav strip is chrome, not page content, so it must recolor with every
-	 * consumer theme that overrides {@code --jc-chrome-bg} (e.g. {@link Theme#LIGHT_BROWN}, {@link Theme#RED},
-	 * {@link Theme#GRAY}) exactly as {@code --jc-hover-bg} already does, rather than staying pinned to
+	 * consumer theme that overrides {@code --jc-chrome-bg} (e.g. {@link Theme#LIGHT_BROWN}, {@link Theme#LIGHT_RED},
+	 * {@link Theme#RED}, {@link Theme#GRAY}) exactly as {@code --jc-hover-bg} already does, rather than staying pinned to
 	 * {@code --jc-white} regardless of the active theme's chrome color. An earlier revision derived
 	 * {@code --jc-header-bg} from {@code --jc-surface} (&rarr; {@code --jc-white}), which left the header
 	 * and nav strip white under every themed chrome &mdash; a latent bug a themed-header/nav test now guards
diff --git a/juneau-rest/juneau-rest-server-console-ui/src/main/java/org/apache/juneau/rest/server/console/Theme.java b/juneau-rest/juneau-rest-server-console-ui/src/main/java/org/apache/juneau/rest/server/console/Theme.java
index 3ef64897a5..a6f6314818 100644
--- a/juneau-rest/juneau-rest-server-console-ui/src/main/java/org/apache/juneau/rest/server/console/Theme.java
+++ b/juneau-rest/juneau-rest-server-console-ui/src/main/java/org/apache/juneau/rest/server/console/Theme.java
@@ -198,6 +198,47 @@ public final class Theme {
 		.token("--jc-accent-selected", "#a9772f")
 		.build();
 
+	/**
+	 * A light-chrome red retint of {@link #OPEN}'s structure &mdash; the sibling of {@link #LIGHT_BROWN}.
+	 *
+	 * <p>
+	 * Recolors the chrome, accent, links, text, borders, and primary button to a wine/rose palette, while keeping
+	 * every one of {@link #OPEN}'s semantic status/tag tokens (info blue, success green, danger red, warning amber,
+	 * neutral gray) verbatim &mdash; a red "danger" pill that matched the brand would stop reading as danger, so
+	 * the status palette is deliberately untouched. Authored as {@link #deriveFrom(String, Theme) deriveFrom}({@link #OPEN}),
+	 * overriding only the 16 recolored tokens below; the other 36 &mdash; including all five tag triads and every
+	 * structural token &mdash; are inherited from {@link #OPEN} unchanged, so this theme's token <i>key</i> set is
+	 * provably identical to {@link #OPEN}'s.
+	 *
+	 * <p>
+	 * Unlike {@link #RED}, this theme keeps a <b>light</b> {@code --jc-chrome-bg} (not {@code #BF2600}): header and
+	 * nav stay parchment-light, with red reserved for accent, links, focus, and the primary button.
+	 *
+	 * <p>
+	 * Caveat: {@link #RED}'s {@code --jc-btn-primary} sits close in hue to {@link #OPEN}'s unchanged semantic
+	 * {@code --jc-danger} (<c>#c23934</c>). This theme avoids that collision by using a darker wine primary
+	 * (<c>#6B1D2A</c>) rather than danger red or the mockup placeholder <c>#a31f34</c>; {@code --jc-danger} itself
+	 * is deliberately left untouched. A consumer still should not reuse {@code --jc-danger} as brand.
+	 */
+	public static final Theme LIGHT_RED = deriveFrom("light-red", OPEN)
+		.token("--jc-page-bg", "linear-gradient(180deg, #e8cfd3 0%, #f0dfe3 22%, #f6eef0 55%, #faf7f8 100%)")
+		.token("--jc-accent", "#B42348")
+		.token("--jc-accent-wash", "rgba(180,35,72,0.1)")
+		.token("--jc-link", "#8B1538")
+		.token("--jc-text", "#2a181c")
+		.token("--jc-text-soft", "#2a181ccc")
+		.token("--jc-text-muted", "#6e585c")
+		.token("--jc-border", "#e4d4d7")
+		.token("--jc-border-2", "#d4c2c6")
+		.token("--jc-card-bg", "#fbf8f9")
+		.token("--jc-chrome-bg", "#f3ecee")
+		.token("--jc-btn-primary", "#6B1D2A")
+		.token("--jc-btn-primary-hover", "#541620")
+		.token("--jc-avatar-bg", "linear-gradient(135deg, #B42348, #6B1D2A)")
+		.token("--jc-focus", "#B42348")
+		.token("--jc-accent-selected", "#B42348")
+		.build();
+
 	/**
 	 * A Jira-inspired red retint of {@link #OPEN}'s structure.
 	 *
diff --git a/juneau-rest/juneau-rest-server-console-ui/src/test/java/org/apache/juneau/rest/server/console/ConsoleChromeMixin_Test.java b/juneau-rest/juneau-rest-server-console-ui/src/test/java/org/apache/juneau/rest/server/console/ConsoleChromeMixin_Test.java
index 5ad6d0fdea..b03d06c3f2 100644
--- a/juneau-rest/juneau-rest-server-console-ui/src/test/java/org/apache/juneau/rest/server/console/ConsoleChromeMixin_Test.java
+++ b/juneau-rest/juneau-rest-server-console-ui/src/test/java/org/apache/juneau/rest/server/console/ConsoleChromeMixin_Test.java
@@ -214,7 +214,7 @@ class ConsoleChromeMixin_Test extends TestBase {
 		var m = Pattern.compile("--jc-header-bg:(var\\(--jc-[a-z0-9-]++\\));").matcher(ConsoleChromeMixin.OPEN_ROLE_ALIASES);
 		assertTrue(m.find(), () -> "no --jc-header-bg alias declaration found in OPEN_ROLE_ALIASES: " + ConsoleChromeMixin.OPEN_ROLE_ALIASES);
 		assertEquals("var(--jc-chrome-bg)", m.group(1),
-			() -> "expected --jc-header-bg to key off --jc-chrome-bg (so LIGHT_BROWN/RED/GRAY chrome-bg overrides recolor the header/nav strip), got: " + m.group(1));
+			() -> "expected --jc-header-bg to key off --jc-chrome-bg (so LIGHT_BROWN/LIGHT_RED/RED/GRAY chrome-bg overrides recolor the header/nav strip), got: " + m.group(1));
 	}
 
 	/** {@code --jc-nav-bg} derives from {@code --jc-header-bg}, so it inherits the chrome-bg fix transitively. */
@@ -233,11 +233,11 @@ class ConsoleChromeMixin_Test extends TestBase {
 
 	/**
 	 * Confirms each stock theme beyond {@link Theme#OPEN} actually overrides {@code --jc-chrome-bg} - combined
-	 * with (c04)'s alias-wiring proof, this is what makes light-brown/red/gray's header/nav strip legitimately
-	 * recolor rather than the fix having no observable effect for the shipped themes.
+	 * with (c04)'s alias-wiring proof, this is what makes light-brown/light-red/red/gray's header/nav strip
+	 * legitimately recolor rather than the fix having no observable effect for the shipped themes.
 	 */
 	@Test void c06_stockThemesBeyondOpen_overrideChromeBg_soTheHeaderNavFixHasVisibleEffect() {
-		for (var theme : List.of(Theme.LIGHT_BROWN, Theme.RED, Theme.GRAY)) {
+		for (var theme : List.of(Theme.LIGHT_BROWN, Theme.LIGHT_RED, Theme.RED, Theme.GRAY)) {
 			var openChromeBg = Theme.OPEN.getTokens().get("--jc-chrome-bg");
 			var themeChromeBg = theme.getTokens().get("--jc-chrome-bg");
 			assertNotEquals(openChromeBg, themeChromeBg,
diff --git a/juneau-rest/juneau-rest-server-console-ui/src/test/java/org/apache/juneau/rest/server/console/Theme_LightRed_Test.java b/juneau-rest/juneau-rest-server-console-ui/src/test/java/org/apache/juneau/rest/server/console/Theme_LightRed_Test.java
new file mode 100644
index 0000000000..258a3fdc59
--- /dev/null
+++ b/juneau-rest/juneau-rest-server-console-ui/src/test/java/org/apache/juneau/rest/server/console/Theme_LightRed_Test.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juneau.rest.server.console;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.apache.juneau.*;
+import org.junit.jupiter.api.*;
+
+/**
+ * {@link Theme#LIGHT_RED} &mdash; the light-chrome red stock token-{@link Theme} beyond {@link Theme#OPEN}.
+ *
+ * <p>
+ * The load-bearing guard is (a01): because {@link Theme#LIGHT_RED} is authored via
+ * {@link Theme#deriveFrom(String, Theme) deriveFrom}({@link Theme#OPEN}), its token <i>key</i> set must be
+ * provably identical to {@link Theme#OPEN}'s, which is what protects the {@code chrome.css} bidirectional
+ * cross-check ({@code ConsoleChromeMixin_Test}) for this theme too.
+ */
+class Theme_LightRed_Test extends TestBase {
+
+	@Test void a01_tokenKeySet_isIdenticalToOpens() {
+		assertEquals(Theme.OPEN.getTokens().keySet(), Theme.LIGHT_RED.getTokens().keySet());
+	}
+
+	@Test void a02_tokenCount_is52_mirroringOpensPin() {
+		assertEquals(52, Theme.LIGHT_RED.getTokens().size());
+	}
+
+	@Test void a03_name_isLightRed() {
+		assertEquals("light-red", Theme.LIGHT_RED.getName());
+	}
+
+	@Test void b01_recoloredSignatureValues() {
+		var tokens = Theme.LIGHT_RED.getTokens();
+		assertEquals("#B42348", tokens.get("--jc-accent"));
+		assertEquals("#8B1538", tokens.get("--jc-link"));
+		assertEquals("#6B1D2A", tokens.get("--jc-btn-primary"));
+		assertEquals("#f3ecee", tokens.get("--jc-chrome-bg"));
+		assertTrue(tokens.get("--jc-page-bg").contains("#e8cfd3"), () -> "expected the light-red gradient, got: " + tokens.get("--jc-page-bg"));
+	}
+
+	@Test void b02_keptFromOpen_statusAndTagValues_areUnchanged() {
+		var tokens = Theme.LIGHT_RED.getTokens();
+		assertEquals(Theme.OPEN.getTokens().get("--jc-white"), tokens.get("--jc-white"));
+		assertEquals(Theme.OPEN.getTokens().get("--jc-danger"), tokens.get("--jc-danger"));
+		assertEquals(Theme.OPEN.getTokens().get("--jc-success"), tokens.get("--jc-success"));
+		assertEquals(Theme.OPEN.getTokens().get("--jc-tag-green-bg"), tokens.get("--jc-tag-green-bg"));
+		assertEquals(Theme.OPEN.getTokens().get("--jc-tag-red-text"), tokens.get("--jc-tag-red-text"));
+	}
+
+	@Test void b03_chromeStaysLight_andPrimaryIsNotDangerOrMockupRed() {
+		var tokens = Theme.LIGHT_RED.getTokens();
+		assertNotEquals("#BF2600", tokens.get("--jc-chrome-bg"));
+		assertNotEquals(Theme.RED.getTokens().get("--jc-chrome-bg"), tokens.get("--jc-chrome-bg"));
+		assertNotEquals("#c23934", tokens.get("--jc-btn-primary"));
+		assertNotEquals("#a31f34", tokens.get("--jc-btn-primary"));
+		assertEquals("#c23934", tokens.get("--jc-danger"));
+	}
+
+	@Test void b04_noVarReferencesLeak_everyValueIsAResolvedLiteral() {
+		for (var e : Theme.LIGHT_RED.getTokens().entrySet())
+			assertFalse(e.getValue().contains("var("), () -> "token '" + e.getKey() + "' leaked an unresolved var() reference: " + e.getValue());
+	}
+
+	@Test void c01_derivedFromOpen_never_equalsOpensOwnName() {
+		assertNotEquals(Theme.OPEN.getName(), Theme.LIGHT_RED.getName());
+	}
+}