xref: /illumos-gate/usr/src/uts/common/sys/rgb.h (revision 7e12ceb3ebc63aeb71e91b496032ca22ca55f660)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2018 Toomas Soome <tsoome@me.com>
14  */
15 
16 #ifndef _SYS_RGB_H
17 #define	_SYS_RGB_H
18 
19 #include <sys/types.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /*
26  * Color data from bootloader.
27  */
28 typedef struct rgb_color {
29 	uint8_t pos;
30 	uint8_t size;
31 } rgb_color_t;
32 
33 typedef struct rgb {
34 	rgb_color_t red;
35 	rgb_color_t green;
36 	rgb_color_t blue;
37 } rgb_t;
38 
39 typedef struct {
40 	uint8_t red[16];
41 	uint8_t green[16];
42 	uint8_t blue[16];
43 } text_cmap_t;
44 
45 extern const text_cmap_t cmap4_to_24;
46 /*
47  * ANSI color to sun color translation.
48  */
49 
50 /* The pc color here is actually referring to standard 16 color VGA map. */
51 typedef enum pc_colors {
52 	pc_black	= 0,
53 	pc_blue		= 1,
54 	pc_green	= 2,
55 	pc_cyan		= 3,
56 	pc_red		= 4,
57 	pc_magenta	= 5,
58 	pc_brown	= 6,
59 	pc_white	= 7,
60 	pc_grey		= 8,
61 	pc_brt_blue	= 9,
62 	pc_brt_green	= 10,
63 	pc_brt_cyan	= 11,
64 	pc_brt_red	= 12,
65 	pc_brt_magenta	= 13,
66 	pc_yellow	= 14,
67 	pc_brt_white	= 15
68 } pc_colors_t;
69 
70 extern const uint8_t dim_xlate[];
71 extern const uint8_t brt_xlate[];
72 extern const uint8_t solaris_color_to_pc_color[16];
73 
74 extern uint32_t rgb_color_map(const rgb_t *, uint8_t);
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 
80 #endif /* _SYS_RGB_H */
81