Convenient aliases

This commit is contained in:
Kovid Goyal 2021-10-28 11:18:16 +05:30
parent 2443dc135c
commit 5f12fbc2ee
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 0 deletions

View File

@ -546,6 +546,10 @@ static PyGetSetDef color_getsetters[] = {
{"green", (getter) green_get, NULL, "green", NULL},
{"blue", (getter) blue_get, NULL, "blue", NULL},
{"alpha", (getter) alpha_get, NULL, "alpha", NULL},
{"r", (getter) red_get, NULL, "red", NULL},
{"g", (getter) green_get, NULL, "green", NULL},
{"b", (getter) blue_get, NULL, "blue", NULL},
{"a", (getter) alpha_get, NULL, "alpha", NULL},
{"luminance", (getter) luminance_get, NULL, "luminance", NULL},
{"as_sgr", (getter) sgr_get, NULL, "as_sgr", NULL},
{"as_sharp", (getter) sharp_get, NULL, "as_sharp", NULL},

View File

@ -627,18 +627,22 @@ class Color:
@property
def red(self) -> int:
pass
r = red
@property
def green(self) -> int:
pass
g = green
@property
def blue(self) -> int:
pass
b = blue
@property
def alpha(self) -> int:
pass
a = alpha
@property
def luminance(self) -> float: