We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f67fbe commit c0bf2b2Copy full SHA for c0bf2b2
modules/colors.html
@@ -77,6 +77,10 @@
77
<th>HWB</th>
78
<td></td>
79
</tr>
80
+ <tr id="colorfunc">
81
+ <th>color()</th>
82
+ <td></td>
83
+ </tr>
84
</tbody>
85
</table>
86
@@ -144,6 +148,19 @@
144
148
cell.textContent = `rgb(${R} ${G} ${B} / ${opacity})`;
145
149
}
146
150
createHSL(R, G, B, opacity);
151
+ createColorFunc(R, G, B, opacity);
152
+ }
153
+
154
+ function createColorFunc(r, g, b, opacity) {
155
+ const cell = document.querySelector("#colorfunc td");
156
+ const R = Number((r / 255).toFixed(2));
157
+ const G = Number((g / 255).toFixed(2));
158
+ const B = Number((b / 255).toFixed(2));
159
+ if (opacity === 1) {
160
+ cell.textContent = `color(srgb ${R} ${G} ${B})`;
161
+ } else {
162
+ cell.textContent = `color(srgb ${R} ${G} ${B} / ${opacity})`;
163
147
164
165
166
function createHSL(r, g, b, opacity) {
0 commit comments