From d1df47e195bc3d9ea5d253442987eb5f7e04b741 Mon Sep 17 00:00:00 2001 From: Matthew Grove Date: Wed, 15 May 2024 21:50:16 +0100 Subject: [PATCH] Util fn to convert colours --- utils.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 utils.py diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..b701052 --- /dev/null +++ b/utils.py @@ -0,0 +1,5 @@ +class Utils: + # method from Tony Goodhew 21st April 2022, for thepihut.com + @staticmethod + def colour(R,G,B): # Convert RGB888 to RGB565 + return (((G&0b00011100)<<3) +((B&0b11111000)>>3)<<8) + (R&0b11111000)+((G&0b11100000)>>5) \ No newline at end of file