Skip to content

colorToCode

Corey Avis edited this page Sep 23, 2026 · 2 revisions

colorToCode

Part of the custom CoreyPHP color code utility system used to dynamically render and style generated files. Converts a human-readable color name back into its corresponding single-character CoreyPHP color code.

Usage

colorToCode(string $color): string

Parameters

color (string) : The full name of the color. This method is case-insensitive and automatically strips internal whitespace (e.g., both Sky Blue and skyblue map to the same color).

Color Code

Return Value

(string) : Returns the lowercase single-character representation of the color. Defaults to "w" (white) if the name is unrecognized.

Examples

$cphp->colorToCode('yellow') = y

Debug Errors

  • No debug errors.

Related Methods

codeToColor | codeToHex | codeToRgb


Home | CoreyPHP | Color Code

Clone this wiki locally