- write-web-color color-list #!optional portprocedure
- write-hex-color color-list #!optional portprocedure
- write-rgb-color color-list #!optional portprocedure
- write-hsl-color color-list #!optional portprocedure
The write-web-color procedure writes any type of color to port (by default, the current output port). Its behavior is as follows:
- rgb color lists are written in #RRGGBB format if alpha is 1, or in rgb() format with integers if alpha is other than 1. (Not all browsers support #RRGGBBAA format yet.)
- rgb% color lists are written in rgb() format with percentages if alpha is 1, or in rgba() format with percentages if alpha is other than 1.
- hsl color lists are written in hsl() format if alpha is 1, or in hsla() format if alpha is other than 1. For compatibility, the hue is written without a unit (degrees is implied).
The other procedures can only write certain types of colors, but are more efficient if only need to write one color type. You can also use them to write in a format that write-web-color would not use. For example, write-hex-color will write an 8 digit hex color if given an rgb or rgb% color list with alpha other than 1, whereas write-web-color would write a rgba() color.
write-hex-color and write-rgb-color accept rgb or rgb% color lists. write-hsl-color accepts hsl color lists.
These procedures signal an error if the color list is invalid or an unsupported type.