• Color-mapper that prefers color names over hex- (or hex-alpha) representation. Thus, strings are returned as is, while RgbColor is transformed via toColorNameOrHex().

    As the original color name may be lost while traversing the CKEditor 5 layers (data → data view → model → data view → data), this assumes, that most BBCode written manually, will prefer color names over hex-values. This mapping expresses this preference and makes it explicit.

    Parameters

    • color: string | RgbColor

      color to map to string

    Returns undefined | string