@@ -3014,17 +3014,132 @@ is the same as that specified in
3014
3014
"color(srgb 0.8816 0.7545 0.4988)".
3015
3015
</div>
3016
3016
3017
+ <h3 id="serial-origin-color">
3018
+ Serializing Origin Colors
3019
+ </h3>
3020
+
3021
+ The serialization of a the declared value of a color
3022
+ used as the [=origin color=] inside of another color function
3023
+ as components of a declared value is:
3024
+
3025
+ 1. For ''rgb()'' , ''rgba()'' , ''hsl()'' , ''hsla()''
3026
+
3027
+ - the string identifying the canonical color function,
3028
+ "rgb" for ''rgb()'' and ''rgba()'' ,
3029
+ "hsl" for ''hsl()'' and ''hsla()'' ,
3030
+ in all-lowercase,
3031
+ followed by "(",
3032
+ followed by a space separated list of the non-alpha components as specified
3033
+ (numbers serializing as numbers,
3034
+ percentages serializing as percentages,
3035
+ angles serializing as canonicalized angles in degrees,
3036
+ calc() serializing in its simplified form)
3037
+ with no clamping applied,
3038
+ followed by " / " and the alpha component as specified
3039
+ (using the same rules as the color components)
3040
+ if an alpha component is present,
3041
+ followed by ")".
3042
+
3043
+ NOTE: the same serialization is used regardless of whether the modern or legacy syntax was used.
3044
+
3045
+ 2. For ''hwb()'' , ''lab()'' , ''lch()'' , ''oklab()'' , ''oklch()''
3046
+
3047
+ - the string identifying the color function in all-lowercase,
3048
+ followed by "(",
3049
+ followed by a space separated list of the non-alpha components as specified
3050
+ (numbers serializing as numbers,
3051
+ percentages serializing as percentages,
3052
+ angles serializing as canonicalized angles in degrees,
3053
+ calc() serializing in its simplified form) with no clamping applied,
3054
+ followed by " / " and the alpha component as specified
3055
+ (using the same rules as the color components)
3056
+ if an alpha component is present,
3057
+ followed by ")".
3058
+
3059
+ 3. For ''color()''
3060
+
3061
+ - the string "color("
3062
+ followed by the canonical colorspace
3063
+ ("xyz-d65" for "xyz") in all-lowercase
3064
+ followed by a space,
3065
+ followed by a space separated list of the non-alpha components as specified
3066
+ (numbers serializing as numbers,
3067
+ percentages serializing as percentages,
3068
+ angles serializing as canonicalized angles in degrees,
3069
+ calc() serializing in its simplified form)
3070
+ with no clamping applied,
3071
+ followed by " / " and the alpha component as specified
3072
+ (using the same rules as the color components)
3073
+ if an alpha component is present,
3074
+ followed by ")".
3075
+
3076
+
3077
+
3017
3078
<h3 id="serial-relative-color">
3018
3079
Serializing Relative Color Functions
3019
3080
</h3>
3020
3081
3021
- The serialization of the declared value of a relative color function
3022
- is a string identifying the color function in all-lowercase,
3023
- followed by "(from ",
3024
- followed by the serialization of the declared value of the origin color,
3025
- followed by a single space,
3026
- followed by a singly-space-separated list of the arguments to the color function,
3027
- followed by ")".
3082
+ The serialization of the declared value of a relative color is:
3083
+
3084
+ 1. For ''rgb()'' , ''rgba()'' , ''hsl()'' , ''hsla()''
3085
+
3086
+ - the string identifying the canonical color function,
3087
+ "rgb" for ''rgb()'' and ''rgba()'' ,
3088
+ "hsl" for ''hsl()'' and ''hsla()'' ,
3089
+ in all-lowercase,
3090
+ followed by "(from ",
3091
+ followed by the <a href="#serial-origin-color">serialization of the origin color</a>
3092
+ using the rules for serializing nested origin colors,
3093
+ followed by a single space,
3094
+ followed by a space separated list of the non-alpha channel arguments as specified
3095
+ (identifiers serializing as identifiers,
3096
+ numbers serializing as numbers,
3097
+ percentages serializing as percentages,
3098
+ angles serializing as canonicalized angles in degrees,
3099
+ calc() serializing in its simplified form),
3100
+ followed by " / " and the alpha component as specified
3101
+ (using the same rules as the color channel arguments)
3102
+ if an alpha component is present,
3103
+ followed by ")".
3104
+
3105
+ 2. For ''hwb()'' , ''lab()'' , ''lch()'' , ''oklab()'' , ''oklch()''
3106
+
3107
+ - the string identifying the color function in all-lowercase,
3108
+ followed by "(from ",
3109
+ followed by the <a href="#serial-origin-color">serialization of the origin color</a>
3110
+ using the rules for serializing nested origin colors,
3111
+ followed by a single space,
3112
+ followed by a space separated list of the non-alpha channel arguments as specified
3113
+ (identifiers serializing as identifiers,
3114
+ numbers serializing as numbers,
3115
+ percentages serializing as percentages,
3116
+ angles serializing as canonicalized angles in degrees,
3117
+ calc() serializing in its simplified form),
3118
+ followed by " / " and the alpha component as specified
3119
+ (using the same rules as the color channel arguments)
3120
+ if an alpha component is present,
3121
+ followed by ")".
3122
+
3123
+ 3. For ''color()''
3124
+
3125
+ - the string "color(from ",
3126
+ followed by the <a href="#serial-origin-color">serialization of the origin color</a>
3127
+ using the rules for serializing nested origin colors,
3128
+ followed by a single space,
3129
+ followed by the canonical colorspace ("xyz-d65" for "xyz")
3130
+ in all-lowercase,
3131
+ followed by a single space,
3132
+ followed by space separated list of the non-alpha channel arguments as specified
3133
+ (identifiers serializing as identifiers,
3134
+ numbers serializing as numbers,
3135
+ percentages serializing as percentages,
3136
+ angles serializing as canonicalized angles in degrees,
3137
+ calc() serializing in its simplified form),
3138
+ followed by " / " and the alpha component as specified
3139
+ (using the same rules as the color channel arguments)
3140
+ if an alpha component is present,
3141
+ followed by ")".
3142
+
3028
3143
3029
3144
<div class="example" id="ex-serial-rcs-specified-simple">
3030
3145
For example, the result of serializing the declared value
0 commit comments