@@ -36,7 +36,6 @@ import { useIsMobile } from "util/hooks";
36
36
import { CSSCodeControl , ObjectControl , RadiusControl , StringControl } from "./codeControl" ;
37
37
import { ColorControl } from "./colorControl" ;
38
38
import {
39
- defaultTheme ,
40
39
DepColorConfig ,
41
40
DEP_TYPE ,
42
41
RadiusConfig ,
@@ -82,6 +81,7 @@ import { faTextWidth } from "@fortawesome/free-solid-svg-icons";
82
81
import appSelectControl from "./appSelectControl" ;
83
82
import { JSONObject , JSONValue } from "@lowcoder-ee/util/jsonTypes" ;
84
83
import { CompTypeContext } from "../utils/compTypeContext" ;
84
+ import { defaultTheme } from "@lowcoder-ee/constants/themeConstants" ;
85
85
86
86
function isSimpleColorConfig ( config : SingleColorConfig ) : config is SimpleColorConfig {
87
87
return config . hasOwnProperty ( "color" ) ;
@@ -357,6 +357,7 @@ function calcColors<ColorMap extends Record<string, string>>(
357
357
) {
358
358
let themeWithDefault = ( theme || defaultTheme ) as unknown as Record < string , string > ;
359
359
themeWithDefault = { ...themeWithDefault , ...( compTheme || { } ) } ;
360
+
360
361
// Cover what is not there for the first pass
361
362
let res : Record < string , string > = { } ;
362
363
colorConfigs . forEach ( ( config ) => {
@@ -628,6 +629,10 @@ function calcColors<ColorMap extends Record<string, string>>(
628
629
}
629
630
if ( isDepColorConfig ( config ) ) {
630
631
if ( config . depType && config . depType === DEP_TYPE . CONTRAST_TEXT ) {
632
+ if ( compTheme ?. [ name ] ) {
633
+ res [ name ] = compTheme [ name ] ;
634
+ return ;
635
+ }
631
636
// bgColor is the background color of the container component, equivalent to canvas
632
637
let depKey = config . depName ? res [ config . depName ] : themeWithDefault [ config . depTheme ! ] ;
633
638
if ( bgColor && config . depTheme === "canvas" ) {
@@ -640,12 +645,16 @@ function calcColors<ColorMap extends Record<string, string>>(
640
645
) ;
641
646
} else if ( config ?. depType === DEP_TYPE . SELF && config . depTheme === "canvas" && bgColor ) {
642
647
res [ name ] = bgColor ;
648
+ } else if ( ( config ?. depType || config ?. depName ) && compTheme ?. [ name ] ) {
649
+ res [ name ] = compTheme [ name ] ;
643
650
} else {
644
651
const rest = [ ] ;
645
652
config . depName && rest . push ( res [ config . depName ] ) ;
646
653
config . depTheme && rest . push ( themeWithDefault [ config . depTheme ] ) ;
647
654
res [ name ] = config . transformer ( rest [ 0 ] , rest [ 1 ] ) ;
648
655
}
656
+ } else {
657
+ res [ name ] = themeWithDefault [ config . name ]
649
658
}
650
659
} ) ;
651
660
return res as ColorMap ;
0 commit comments