device-cmyk()

device-cmyk() 函数标记用于以设备依赖的方式表达 CMYK 颜色,指定其青色、品红色、黄色和黑色成分。

创建要输出到特定打印机的材料时,若特定墨水组合的输出的已知的,这种颜色方法非常有用。CSS 处理器可能会尝试近似颜色,但最终结果可能与打印结果不同。

语法

css
device-cmyk(0 81% 81% 30%);
device-cmyk(0 81% 81% 30% / .5);
device-cmyk(0 81% 81% 30% / .5, rgb(178 34 34));

函数标记:device-cmyk(C M Y K[ / A][, color])

CMYK

<number><percentage> 值,提供 CMYK 颜色的青色、品红色、黄色和黑色成分。

A 可选

<alpha-value> 值,其中 1 对应 100%(完全不透明)。

color 可选

可选的后备 <color> 值,当用户代理不知道如何将 CMYK 颜色转换为 RGB 颜色时使用。

形式语法

<device-cmyk()> = 
<legacy-device-cmyk-syntax> |
<modern-device-cmyk-syntax>

<legacy-device-cmyk-syntax> =
device-cmyk( <number>#{4} )

<modern-device-cmyk-syntax> =
device-cmyk( <cmyk-component>{4} [ / [ <alpha-value> | none ] ]? )

<cmyk-component> =
<number> |
<percentage> |
none

<alpha-value> =
<number> |
<percentage>

规范

Specification
CSS Color Module Level 5
# device-cmyk

浏览器兼容性

BCD tables only load in the browser