@@ -287,11 +287,11 @@ function serializeCalculationFunction({ range = {}, round, value }, forComputedO
287287
288288/**
289289 * @param {object } color
290- * @param {boolean } mixed
290+ * @param {boolean } specified
291291 * @returns {string }
292292 * @see {@link https://drafts.csswg.org/css-color-4/#serializing-color-values }
293293 */
294- function serializeColor ( { name, types, value } , mixed = false ) {
294+ function serializeColor ( { name, types, value } , specified = false ) {
295295 if ( types . includes ( '<keyword>' ) ) {
296296 return value
297297 }
@@ -337,6 +337,15 @@ function serializeColor({ name, types, value }, mixed = false) {
337337 if ( types . includes ( '<legacy-device-cmyk-syntax>' ) ) {
338338 return `device-cmyk(${ serializeCSSComponentValueList ( value , ' ' ) } )`
339339 }
340+ if ( types . includes ( '<contrast-color()>' ) ) {
341+ const [ color , max ] = value
342+ let string = `contrast-color(${ serializeColor ( color , true ) } `
343+ if ( ! isOmitted ( max ) ) {
344+ string += ' max'
345+ }
346+ string += ')'
347+ return string
348+ }
340349 let alpha
341350 if ( types . includes ( '<hex-color>' ) ) {
342351 const [ n1 , n2 , n3 , n4 , n5 , n6 , n7 , n8 ] = value
@@ -451,7 +460,7 @@ function serializeColor({ name, types, value }, mixed = false) {
451460 break
452461 }
453462 }
454- if ( source || mixed ) {
463+ if ( source || specified ) {
455464 channels . push ( value )
456465 return channels
457466 }
@@ -491,7 +500,7 @@ function serializeColor({ name, types, value }, mixed = false) {
491500 return channels
492501 } , [ ] )
493502
494- if ( ! resolved || source || mixed ) {
503+ if ( ! resolved || source || specified ) {
495504 if ( name === 'rgba' || name === 'hsla' ) {
496505 name = name . slice ( 0 , - 1 )
497506 }
0 commit comments