Skip to content

Color

Color with RGBA components (0.0 to 1.0), 148 named colors, and .with_alpha() for transparency.

import cesiumkit

point = cesiumkit.PointGraphics(
    color=cesiumkit.Color.from_css("#ff8800"),
    outline_color=cesiumkit.Color.RED.with_alpha(0.5),
)

color

Color system for cesiumkit, matching all CesiumJS named colors.

Classes:

Name Description
Color

Represents a Cesium color with RGBA components (0.0 to 1.0).

Color

Bases: CesiumBase

Represents a Cesium color with RGBA components (0.0 to 1.0).

Methods:

Name Description
with_alpha

Return a new Color with the given alpha value.

from_bytes

Create a Color from byte values (0-255).

from_css

Create a Color from a CSS color string.

from_random

Create a Color with random components. Fixed values can be provided.

with_alpha

with_alpha(alpha: float) -> Color

Return a new Color with the given alpha value.

from_bytes classmethod

from_bytes(red: int, green: int, blue: int, alpha: int = 255) -> Color

Create a Color from byte values (0-255).

from_css classmethod

from_css(css_string: str) -> Color

Create a Color from a CSS color string.

Supports #RRGGBB and #RRGGBBAA hex formats.

from_random classmethod

from_random(
    red: float | None = None,
    green: float | None = None,
    blue: float | None = None,
    alpha: float | None = None,
) -> Color

Create a Color with random components. Fixed values can be provided.