![]() |
Bridges-Python-3.0.0
3.0.0b
Bridges(PythonAPI)
|
This class is used to represent colors in bridges.
We use and RGBA model to represent colors, with the Red Green and Blue components ranging from 0-255, with the alpha ranging from 0.0-1.0 inclusive.
We use webcolors to handle color names passed to the constructor/set_color function. https://www.w3.org/TR/css-color-3/#svg-color
Color names are listed below:
aliceblue, antiquewhite, cyan, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, darkblue, darkcyan, darkgoldenrod, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, magenta, gainsboro, ghostwhite, gold, goldenrod, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow yellowgreen
rgba (tuple(int, int, int, alpha)): RGBA components as respective tuple
args | int, int, int, Optional(float) or a str as singular arg r or red: Optional(int) b or blue: Optional(int) g or green: Optional(int) a or alpha: Optional(float) |
col_name | Optional(str) |
ValueError | if args is not 3 ints with an optional 4th arg for alpha or just one str arg |
ValueError | if a str passed is not a valid webcolor |
ValueError | if any of the RGBA values are outside of their respective range |
Public Member Functions | |
def | red (self) |
def | red |
Setter for red component of color (0-255 inclusive) More... | |
def | green (self) |
Getter for green component of color (0-255 inclusive) More... | |
def | green |
Setter for green component of color (0-255 inclusive) More... | |
def | blue (self) |
Getter for blue component of color (0-255 inclusive) More... | |
def | blue |
Setter for blue component of color (0-255 inclusive) More... | |
def | alpha (self) |
Getter for alpha(opacity) component of color (0-1.0 inclusive) More... | |
def | alpha |
Setter for alpha component of color (0-1.0 inclusive) More... | |
def | rgba (self, int, int, int, float) |
RGBA components as respective tuple Represents the RGBA values of the color as a tuple, can be used to set or get all values at once :return (int, int, int, float): RGBA values respectively. More... | |
def | rgba |
def | __init__ (self, args, kwargs) |
Constructor for a Color object Usage requires either 3 ints 0-255 for RGB and an optional float 0.0-1.0 for alpha or a str of a web color can also key the RGBA values with r, g, b, a or red, green, blue, alpha respectively and col_name for the str :param args: int, int, int, optional float or just a str :param kwargs: r/red: int, b/blue: int, g/green: int optional a/alpha: float or col_name: str :return: None. More... | |
def | set_color (self, args, kwargs) |
def | get_byte_representation (self) |
:return list(int):RGBA values as list of ints from 0-255 More... | |
def | __eq__ (self, other) |
deep equality check, by value of each RGBA value More... | |
Public Attributes | |
alpha | |
alpha component of color ranging from 0.0-1.0 inclusive (default 1.0) More... | |
red | |
red component of color ranging from 0-255 inclusive (default 0) More... | |
green | |
green component of color ranging from 0-255 inclusive (default 0) More... | |
blue | |
blue component of color ranging from 0-255 inclusive (default 0) More... | |
def bridges.color.Color.__init__ | ( | self, | |
args, | |||
kwargs | |||
) |
Constructor for a Color object Usage requires either 3 ints 0-255 for RGB and an optional float 0.0-1.0 for alpha or a str of a web color can also key the RGBA values with r, g, b, a or red, green, blue, alpha respectively and col_name for the str :param args: int, int, int, optional float or just a str :param kwargs: r/red: int, b/blue: int, g/green: int optional a/alpha: float or col_name: str :return: None.
def bridges.color.Color.__eq__ | ( | self, | |
other | |||
) |
deep equality check, by value of each RGBA value
def bridges.color.Color.alpha | ( | self, | |
float | |||
) |
Getter for alpha(opacity) component of color (0-1.0 inclusive)
def bridges.color.Color.alpha | ( | self, | |
value | |||
) |
Setter for alpha component of color (0-1.0 inclusive)
value | alpha component of color (0-1.0) |
def bridges.color.Color.blue | ( | self, | |
int | |||
) |
Getter for blue component of color (0-255 inclusive)
def bridges.color.Color.blue | ( | self, | |
value | |||
) |
Setter for blue component of color (0-255 inclusive)
value | blue component of color |
def bridges.color.Color.get_byte_representation | ( | self, | |
list | |||
) |
:return list(int):RGBA values as list of ints from 0-255
def bridges.color.Color.green | ( | self, | |
int | |||
) |
Getter for green component of color (0-255 inclusive)
def bridges.color.Color.green | ( | self, | |
value | |||
) |
Setter for green component of color (0-255 inclusive)
value | green component of color |
def bridges.color.Color.red | ( | self, | |
int | |||
) |
def bridges.color.Color.red | ( | self, | |
value | |||
) |
Setter for red component of color (0-255 inclusive)
value | red component of color |
def bridges.color.Color.rgba | ( | self, | |
int, | |||
int, | |||
int, | |||
float | |||
) |
RGBA components as respective tuple Represents the RGBA values of the color as a tuple, can be used to set or get all values at once :return (int, int, int, float): RGBA values respectively.
def bridges.color.Color.rgba | ( | self, | |
rgba | |||
) |
def bridges.color.Color.set_color | ( | self, | |
args, | |||
kwargs, | |||
None | |||
) |
bridges.color.Color.alpha |
alpha component of color ranging from 0.0-1.0 inclusive (default 1.0)
Getter for red component of color (0-255 inclusive)
bridges.color.Color.blue |
blue component of color ranging from 0-255 inclusive (default 0)
bridges.color.Color.green |
green component of color ranging from 0-255 inclusive (default 0)
bridges.color.Color.red |
red component of color ranging from 0-255 inclusive (default 0)