Grease logo

Previous topic

grease.collision – Collision Detection

Next topic

grease.component – Entity Data Containers

This Page

grease.color – Colors

class grease.color.RGBA(r_or_colorstr, g=None, b=None, a=None)[source]

Four channel color representation.

RGBA colors are floating point color representations with color channel values between (0..1). Colors may be initialized from 3 or 4 floating point numbers or a hex string:

RGBA(1.0, 1.0, 1.0) # Alpha defaults to 1.0
RGBA(1.0, 1.0, 0, 0.5)
RGBA("#333")
RGBA("#7F7F7F")

Individual color channels can be accessed by attribute name, or the color object can be treated as a sequence of 4 floats.