mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-07-01 12:26:26 +00:00
wip: project structure
This commit is contained in:
16
ui/extends/shared/color.py
Normal file
16
ui/extends/shared/color.py
Normal file
@ -0,0 +1,16 @@
|
||||
from PySide6.QtGui import QColor
|
||||
|
||||
|
||||
def mix_color(source_color: QColor, mix_color: QColor, mix_ratio: float = 0.5):
|
||||
r = round((mix_color.red() - source_color.red()) * mix_ratio + source_color.red())
|
||||
g = round(
|
||||
(mix_color.green() - source_color.green()) * mix_ratio + source_color.green()
|
||||
)
|
||||
b = round(
|
||||
(mix_color.blue() - source_color.blue()) * mix_ratio + source_color.blue()
|
||||
)
|
||||
a = round(
|
||||
(mix_color.alpha() - source_color.alpha()) * mix_ratio + source_color.alpha()
|
||||
)
|
||||
|
||||
return QColor(r, g, b, a)
|
Reference in New Issue
Block a user