commit 1645e48

uint  ·  2026-07-14 11:47:34 +0000 UTC
parent 704cad4
reorder colors
3 files changed,  +9, -12
+2, -3
 1@@ -13,14 +13,14 @@
 2 void die(int ec, const char* msg);
 3 
 4 /**
 5- * @brief convert red, green, blue, alpha values to a packed value
 6+ * @brief convert red, green, blue, alpha values to a AARRGGBB value
 7  *
 8  * @param r red value
 9  * @param g green value
10  * @param b blue value
11  * @param a alpha value
12  *
13- * @return packed rbga value
14+ * @return packed color value
15  */
16 uint32_t rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
17 
18@@ -32,4 +32,3 @@ uint32_t rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
19 void* xmalloc(size_t len);
20 
21 #endif /* UTILS_H */
22-
+5, -6
 1@@ -26,11 +26,11 @@ static void sgr(Term* t);
 2 static void utf8_flush(Term* t, Caret* c);
 3 static void utf8_putc(Term* t, Caret* c, unsigned char ch);
 4 
 5-static const uint32_t ansi_colours[16] = { /* TODO */
 6-	0xff000000, 0xff0000cd, 0xff00cd00, 0xff00cdcd,
 7-	0xffee0000, 0xffcd00cd, 0xffcdcd00, 0xffe5e5e5,
 8-	0xff7f7f7f, 0xff0000ff, 0xff00ff00, 0xff00ffff,
 9-	0xffff5c5c, 0xffff00ff, 0xffffff00, 0xffffffff,
10+static const uint32_t ansi_colours[16] = {
11+	0xff000000, 0xffcd0000, 0xff00cd00, 0xffcdcd00,
12+	0xff0000ee, 0xffcd00cd, 0xff00cdcd, 0xffe5e5e5,
13+	0xff7f7f7f, 0xffff0000, 0xff00ff00, 0xffffff00,
14+	0xff5c5cff, 0xffff00ff, 0xff00ffff, 0xffffffff,
15 };
16 
17 /** TODO
18@@ -851,4 +851,3 @@ bool term_write(Term* t, Caret* c, const char* s, size_t n)
19 
20 	return damaged;
21 }
22-
+2, -3
 1@@ -14,9 +14,9 @@ uint32_t rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
 2 {
 3 	return
 4 		((uint32_t)a << 24) |
 5-		((uint32_t)b << 16) |
 6+		((uint32_t)r << 16) |
 7 		((uint32_t)g << 8)  |
 8-		((uint32_t)r);
 9+		((uint32_t)b);
10 }
11 
12 void* xmalloc(size_t len)
13@@ -26,4 +26,3 @@ void* xmalloc(size_t len)
14 		die(EXIT_FAILURE, "malloc failed");
15 	return p;
16 }
17-