Add aliases to GraphicsCommand to make it more useable
This commit is contained in:
Generated
+8
-3
@@ -8,9 +8,9 @@ from typing import Optional, NamedTuple
|
||||
|
||||
|
||||
class Color(NamedTuple):
|
||||
red: int
|
||||
green: int
|
||||
blue: int
|
||||
red: int = 0
|
||||
green: int = 0
|
||||
blue: int = 0
|
||||
|
||||
def luminance(self) -> float:
|
||||
return 0.299 * self.red + 0.587 * self.green + 0.114 * self.blue
|
||||
@@ -25,6 +25,11 @@ class Color(NamedTuple):
|
||||
def __int__(self) -> int:
|
||||
return self.red << 16 | self.green << 8 | self.blue
|
||||
|
||||
def as_bytearray(self, alpha: Optional[int] = None) -> bytearray:
|
||||
if alpha is None:
|
||||
return bytearray((self.red, self.green, self.blue))
|
||||
return bytearray((self.red, self.green, self.blue, alpha))
|
||||
|
||||
|
||||
def alpha_blend_channel(top_color: int, bottom_color: int, alpha: float) -> int:
|
||||
return int(alpha * top_color + (1 - alpha) * bottom_color)
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ AddressFamily = PopenType = Socket = StartupCtx = None
|
||||
SessionTab = SessionType = LayoutType = SpecialWindowInstance = None
|
||||
MarkType = RemoteCommandType = CoreTextFont = FontConfigPattern = None
|
||||
KeyEventType = ImageManagerType = KittyCommonOpts = HandlerType = None
|
||||
GRT_t = GRT_a = GRT_d = GRT_f = GRT_m = GRT_o = None
|
||||
GRT_t = GRT_a = GRT_d = GRT_f = GRT_m = GRT_o = GRT_C = None
|
||||
ScreenSize = KittensKeyActionType = MouseEvent = AbstractEventLoop = None
|
||||
TermManagerType = LoopType = Debug = GraphicsCommandType = None
|
||||
|
||||
|
||||
+2
-1
@@ -37,11 +37,12 @@ from .window import Window as WindowType
|
||||
EdgeLiteral = Literal['left', 'top', 'right', 'bottom']
|
||||
MatchType = Literal['mime', 'ext', 'protocol', 'file', 'path', 'url', 'fragment_matches']
|
||||
PowerlineStyle = Literal['angled', 'slanted', 'round']
|
||||
GRT_a = Literal['t', 'T', 'q', 'p', 'd', 'f', 'a']
|
||||
GRT_a = Literal['t', 'T', 'q', 'p', 'd', 'f', 'a', 'c', 'q']
|
||||
GRT_f = Literal[24, 32, 100]
|
||||
GRT_t = Literal['d', 'f', 't', 's']
|
||||
GRT_o = Literal['z']
|
||||
GRT_m = Literal[0, 1]
|
||||
GRT_C = Literal[0, 1]
|
||||
GRT_d = Literal['a', 'A', 'c', 'C', 'i', 'I', 'p', 'P', 'q', 'Q', 'x', 'X', 'y', 'Y', 'z', 'Z', 'f', 'F']
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user