From 04158b39cdbfd5f2ae224b166c4eba151ee2d340 Mon Sep 17 00:00:00 2001 From: Paul Peavyhouse Date: Wed, 16 Oct 2019 23:21:30 -0700 Subject: [PATCH] Fully tested values 5 bit red/blue 0 to 31 and 6 bit green 0 to 63 --- src/lv_misc/lv_color.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lv_misc/lv_color.h b/src/lv_misc/lv_color.h index 4a6c6b6c7..11d7cc1a9 100644 --- a/src/lv_misc/lv_color.h +++ b/src/lv_misc/lv_color.h @@ -310,9 +310,9 @@ static inline uint32_t lv_color_to32(lv_color_t color) * Truly any of the listed multipliers and adders would work. * The below numbers seem the most precise. */ - ret.ch.red = ( color.ch.red * 33 ) >> 2; - ret.ch.green = ( color.ch.green * 4 ); - ret.ch.blue = ( color.ch.blue * 33 ) >> 2; + ret.ch.red = ( color.ch.red * 8423 + 7 ) >> 10; + ret.ch.green = ( color.ch.green * 259 + 3 ) >> 6; + ret.ch.blue = ( color.ch.blue * 8423 + 7 ) >> 10; ret.ch.alpha = 0xFF; return ret.full; #else