Skip to content

Color

lerax.render.Color

Bases: eqx.Module

RGB in [0,1]. Helpers to convert to pygame-friendly formats.

r instance-attribute

r: Float[Array, ''] = jnp.asarray(r)

g instance-attribute

g: Float[Array, ''] = jnp.asarray(g)

b instance-attribute

b: Float[Array, ''] = jnp.asarray(b)

__init__

__init__(
    r: Float[ArrayLike, ""],
    g: Float[ArrayLike, ""],
    b: Float[ArrayLike, ""],
)

to_tuple

to_tuple() -> tuple[
    Float[ArrayLike, ""],
    Float[ArrayLike, ""],
    Float[ArrayLike, ""],
]

to_rgb255

to_rgb255() -> tuple[int, int, int]

to_hex

to_hex() -> str

from_hex classmethod

from_hex(hex_str: str) -> Color

from_rgb255 classmethod

from_rgb255(r: int, g: int, b: int) -> Color

from_tuple classmethod

from_tuple(
    rgb: tuple[
        Float[ArrayLike, ""],
        Float[ArrayLike, ""],
        Float[ArrayLike, ""],
    ],
) -> Color

lerax.render.WHITE module-attribute

WHITE = Color(1.0, 1.0, 1.0)

lerax.render.BLACK module-attribute

BLACK = Color(0.0, 0.0, 0.0)

lerax.render.GRAY module-attribute

GRAY = Color(0.78, 0.78, 0.78)

lerax.render.RED module-attribute

RED = Color(0.86, 0.24, 0.24)

lerax.render.GREEN module-attribute

GREEN = Color(0.24, 0.71, 0.29)

lerax.render.BLUE module-attribute

BLUE = Color(0.26, 0.53, 0.96)