File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,22 +163,21 @@ const ContrastInput = memo(function ContrastInput({
163163
164164const LevelChromaInput = withValidation ( withNumericIncrementControls ( Input ) ) ;
165165const ChromaInput = memo ( function ChromaInput ( { levelId } : LevelComponentProps ) {
166+ const level = getLevel ( levelId ) ;
167+ const chromaCap = useSubscribe ( level . chromaCap . $raw ) ;
168+ const error = useSubscribe ( level . chromaCap . $validationError ) ;
166169 const $chromaPlaceholder = useSignal ( ( get ) => {
167170 return get ( chromaModeStore . $lastValidValue ) === "even"
168- ? get ( level . $tintColor ) . referencedC . toFixed ( 2 )
171+ ? get ( level . chroma . $lastValidValue ) . toFixed ( 2 )
169172 : "max" ;
170173 } ) ;
171174 const $chromaLabel = useSignal ( ( get ) => {
172175 const chromaCap = get ( level . chromaCap . $raw ) ;
173176
174177 return chromaCap ? LABEL_CHROMA_CAP_DEFINED : LABEL_CHROMA_CAP_SET ;
175178 } ) ;
176-
177- const level = getLevel ( levelId ) ;
178- const chromaCap = useSubscribe ( level . chromaCap . $raw ) ;
179179 const chromaLabel = useSubscribe ( $chromaLabel ) ;
180180 const chromaPlaceholder = useSubscribe ( $chromaPlaceholder ) ;
181- const error = useSubscribe ( level . chromaCap . $validationError ) ;
182181
183182 return (
184183 < LevelChromaInput
Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ function handleGeneratedColor(payload: GeneratedColorPayload) {
129129
130130 levelStore . $tintColor . set ( payload . tint ) ;
131131 for ( const [ hueId , color ] of objectEntries ( payload . cells ) ) {
132+ levelStore . chroma . $raw . set ( color . c ) ;
132133 upsertColor ( payload . levelId , hueId , color ) ;
133134 }
134135 } ) ;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ export const FALLBACK_HUE_TINT_COLOR = FALLBACK_COLOR_DATA;
1212
1313export const FALLBACK_LEVEL_TINT_COLOR = {
1414 ...FALLBACK_COLOR_DATA ,
15- referencedC : 0 ,
1615} as ColorLevelTintData ;
1716
1817export const FALLBACK_CELL_COLOR = {
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export type ColorData = LchColor & {
6161 css : ColorString ;
6262} ;
6363export type ColorHueTintData = ColorData ;
64- export type ColorLevelTintData = ColorData & { referencedC : LevelChroma } ;
64+ export type ColorLevelTintData = ColorData ;
6565export type ColorCellData = ColorData & {
6666 p3 : boolean ;
6767} ;
Original file line number Diff line number Diff line change @@ -124,7 +124,6 @@ export function calculateColors(
124124 contrastLevel : MIN_LEVEL_TINT_CR ,
125125 chroma : LevelChroma ( 0 ) ,
126126 } ) ,
127- referencedC : LevelChroma ( 0 ) ,
128127 } ,
129128 cells : { } ,
130129 } ) ;
@@ -151,7 +150,7 @@ export function calculateColors(
151150
152151 // Calculate level tint based only on the first hue row
153152 if ( hueIndex === 0 ) {
154- tint = { ... cellColor , referencedC : cellColor . c } ;
153+ tint = cellColor ;
155154
156155 if ( tint . cr < MIN_LEVEL_TINT_CR ) {
157156 tint = {
@@ -161,7 +160,6 @@ export function calculateColors(
161160 contrastLevel : MIN_LEVEL_TINT_CR ,
162161 chroma : chroma ,
163162 } ) ,
164- referencedC : cellColor . c ,
165163 } ;
166164 }
167165 }
You can’t perform that action at this time.
0 commit comments