Adjust shades
This commit is contained in:
parent
f2d3f5ec07
commit
fb6f09fce5
|
@ -3,12 +3,12 @@ use egui::{Color32, Image, ImageSource, Response, Sense, TextureOptions, Ui, Wid
|
|||
pub const GENERIC_PALETTE: [u8; 4] = [0, 32, 64, 128];
|
||||
|
||||
pub fn shade(brt: u8, color: Color32) -> Color32 {
|
||||
let corrected = if brt & 0x80 != 0 {
|
||||
255
|
||||
let corrected = if brt > 132 {
|
||||
255.0
|
||||
} else {
|
||||
(brt << 1) | (brt >> 6)
|
||||
(brt as f32 * 255.0 / 133.0).round()
|
||||
};
|
||||
color.gamma_multiply(corrected as f32 / 255.0)
|
||||
color.gamma_multiply(corrected / 255.0)
|
||||
}
|
||||
|
||||
pub fn generic_palette(color: Color32) -> [Color32; 4] {
|
||||
|
|
Loading…
Reference in New Issue