@@ -115,6 +115,16 @@ type RuntimeGraphqlConfig = {
115115 authToken : string ;
116116} ;
117117
118+ const THEME_COLOR = {
119+ text : "var(--cms-ui-text, var(--cms-text, #0f172a))" ,
120+ muted : "var(--cms-ui-muted, var(--cms-muted, #64748b))" ,
121+ surface : "var(--cms-ui-surface, var(--cms-surface, #ffffff))" ,
122+ elevated : "var(--cms-ui-elevated, #f8fafc)" ,
123+ border : "var(--cms-ui-border, var(--cms-border, #cbd5e1))" ,
124+ accent : "var(--cms-ui-accent, var(--cms-accent, #1d4ed8))" ,
125+ onAccent : "var(--cms-on-accent, #ffffff)" ,
126+ } as const ;
127+
118128function asRecord ( value : unknown ) : Record < string , unknown > {
119129 if ( ! value || typeof value !== "object" || Array . isArray ( value ) ) {
120130 return { } ;
@@ -742,9 +752,15 @@ export const createModule: ModuleFactory = (ctx): ModuleRuntime => {
742752 item . style . display = "grid" ;
743753 item . style . gap = "0.25rem" ;
744754 item . style . padding = "0.45rem 0.55rem" ;
745- item . style . border = " 1px solid #d2dbe8" ;
755+ item . style . border = ` 1px solid ${ THEME_COLOR . border } ` ;
746756 item . style . borderRadius = "8px" ;
747- item . style . background = role === "user" ? "#f3f8ff" : role === "assistant" ? "#ffffff" : "#f8fafc" ;
757+ item . style . background =
758+ role === "user"
759+ ? THEME_COLOR . elevated
760+ : role === "assistant"
761+ ? THEME_COLOR . surface
762+ : THEME_COLOR . elevated ;
763+ item . style . color = THEME_COLOR . text ;
748764 const label = document . createElement ( "strong" ) ;
749765 label . textContent = role === "user" ? "You" : role === "assistant" ? props . assistantLabel : "System" ;
750766 const body = document . createElement ( "div" ) ;
@@ -767,9 +783,10 @@ export const createModule: ModuleFactory = (ctx): ModuleRuntime => {
767783 item . style . display = "grid" ;
768784 item . style . gap = "0.25rem" ;
769785 item . style . padding = "0.45rem 0.55rem" ;
770- item . style . border = " 1px solid #d2dbe8" ;
786+ item . style . border = ` 1px solid ${ THEME_COLOR . border } ` ;
771787 item . style . borderRadius = "8px" ;
772- item . style . background = "#ffffff" ;
788+ item . style . background = THEME_COLOR . surface ;
789+ item . style . color = THEME_COLOR . text ;
773790 const label = document . createElement ( "strong" ) ;
774791 label . textContent = props . assistantLabel ;
775792 const body = document . createElement ( "div" ) ;
@@ -1041,10 +1058,10 @@ export const createModule: ModuleFactory = (ctx): ModuleRuntime => {
10411058 container . style . width = "100%" ;
10421059 container . style . maxWidth = "44rem" ;
10431060 container . style . padding = "0.875rem" ;
1044- container . style . border = " 1px solid #cbd5e1" ;
1061+ container . style . border = ` 1px solid ${ THEME_COLOR . border } ` ;
10451062 container . style . borderRadius = "10px" ;
1046- container . style . background = "#ffffff" ;
1047- container . style . color = "#0f172a" ;
1063+ container . style . background = THEME_COLOR . surface ;
1064+ container . style . color = THEME_COLOR . text ;
10481065 container . style . boxSizing = "border-box" ;
10491066
10501067 const header = document . createElement ( "header" ) ;
@@ -1059,7 +1076,7 @@ export const createModule: ModuleFactory = (ctx): ModuleRuntime => {
10591076
10601077 statusEl = document . createElement ( "div" ) ;
10611078 statusEl . style . fontSize = "0.78rem" ;
1062- statusEl . style . color = "#64748b" ;
1079+ statusEl . style . color = THEME_COLOR . muted ;
10631080 {
10641081 const channelSummary = formatAsyncChannelSummary ( props . async ) ;
10651082 setStatus (
@@ -1077,8 +1094,8 @@ export const createModule: ModuleFactory = (ctx): ModuleRuntime => {
10771094 listEl . style . maxHeight = "14rem" ;
10781095 listEl . style . overflow = "auto" ;
10791096 listEl . style . padding = "0.2rem" ;
1080- listEl . style . background = "#f8fafc" ;
1081- listEl . style . border = " 1px solid #e2e8f0" ;
1097+ listEl . style . background = THEME_COLOR . elevated ;
1098+ listEl . style . border = ` 1px solid ${ THEME_COLOR . border } ` ;
10821099 listEl . style . borderRadius = "8px" ;
10831100
10841101 formEl = document . createElement ( "form" ) ;
@@ -1091,8 +1108,10 @@ export const createModule: ModuleFactory = (ctx): ModuleRuntime => {
10911108 inputEl . placeholder = props . inputPlaceholder ;
10921109 inputEl . autocomplete = "off" ;
10931110 inputEl . style . minHeight = "2.25rem" ;
1094- inputEl . style . border = " 1px solid #cbd5e1" ;
1111+ inputEl . style . border = ` 1px solid ${ THEME_COLOR . border } ` ;
10951112 inputEl . style . borderRadius = "8px" ;
1113+ inputEl . style . background = THEME_COLOR . surface ;
1114+ inputEl . style . color = THEME_COLOR . text ;
10961115 inputEl . style . padding = "0.4rem 0.6rem" ;
10971116 inputEl . style . fontSize = "0.9rem" ;
10981117
@@ -1101,12 +1120,12 @@ export const createModule: ModuleFactory = (ctx): ModuleRuntime => {
11011120 submitEl . textContent = props . submitLabel ;
11021121 submitEl . style . minWidth = "6rem" ;
11031122 submitEl . style . minHeight = "2.25rem" ;
1104- submitEl . style . border = " 1px solid #1e3a8a" ;
1123+ submitEl . style . border = ` 1px solid ${ THEME_COLOR . accent } ` ;
11051124 submitEl . style . borderRadius = "8px" ;
11061125 submitEl . style . padding = "0.4rem 0.75rem" ;
11071126 submitEl . style . fontWeight = "600" ;
1108- submitEl . style . background = "#1d4ed8" ;
1109- submitEl . style . color = "#ffffff" ;
1127+ submitEl . style . background = THEME_COLOR . accent ;
1128+ submitEl . style . color = THEME_COLOR . onAccent ;
11101129 submitEl . style . cursor = "pointer" ;
11111130
11121131 formEl . append ( inputEl , submitEl ) ;
0 commit comments