MPLABĀ® Harmony Graphics Suite
legato_scheme.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_scheme.h
32 
33  Summary:
34  A scheme is a collection of colors that can be referenced by one or more
35  widgets. Widgets may use schemes in different ways. While the color
36  names strive to be intuitive they aren't always used in the manner in
37  which they describe.
38 *******************************************************************************/
39 
50 #ifndef LEGATO_SCHEME_H
51 #define LEGATO_SCHEME_H
52 
54 
56 
57 #ifdef __cplusplus
58  extern "C" {
59 #endif
60 
61 // *****************************************************************************
62 // *****************************************************************************
63 // Section: Data Types and Constants
64 // *****************************************************************************
65 // *****************************************************************************
66 enum leSchemeColorModes
67 {
68  LE_SCHM_COLOR_MODE_GS_8 = LE_COLOR_MODE_GS_8,
69  LE_SCHM_COLOR_MODE_RGB_332 = LE_COLOR_MODE_RGB_332,
70  LE_SCHM_COLOR_MODE_RGB_565 = LE_COLOR_MODE_RGB_565,
71  LE_SCHM_COLOR_MODE_RGBA_5551 = LE_COLOR_MODE_RGBA_5551,
72  LE_SCHM_COLOR_MODE_RGB_888 = LE_COLOR_MODE_RGB_888,
73  LE_SCHM_COLOR_MODE_RGBA_8888 = LE_COLOR_MODE_RGBA_8888,
74  LE_SCHM_COLOR_MODE_ARGB_8888 = LE_COLOR_MODE_ARGB_8888,
75  LE_SCHM_COLOR_MODE_GLOBALPALETTE = LE_COLOR_MODE_PALETTE,
76 };
77 
78 typedef enum leSchemeColor
79 {
80  LE_SCHM_BASE,
81  LE_SCHM_HIGHLIGHT,
82  LE_SCHM_HIGHLIGHTLIGHT,
83  LE_SCHM_SHADOW,
84  LE_SCHM_SHADOWDARK,
85  LE_SCHM_FOREGROUND,
86  LE_SCHM_FOREGROUND_INACTIVE,
87  LE_SCHM_FOREGROUND_DISABLED,
88  LE_SCHM_BACKGROUND,
89  LE_SCHM_BACKGROUND_INACTIVE,
90  LE_SCHM_BACKGROUND_DISABLED,
91  LE_SCHM_TEXT,
92  LE_SCHM_TEXT_HIGHLIGHT,
93  LE_SCHM_TEXT_HIGHLIGHTTEXT,
94  LE_SCHM_TEXT_INACTIVE,
95  LE_SCHM_TEXT_DISABLED
96 } leSchemeColor;
97 
98 #define LE_SCHEME_COLOR_COUNT 16
99 #define LE_SCHEME_COLOR_MODE_COUNT LE_COLOR_MODE_COUNT
100 
101 /*
102  Union:
103  leSchemeColorTable
104 
105  Summary:
106  This union specifies a list of scheme colors for a given color mode.
107 
108  Description:
109  This union specifies a list of scheme colors for a given color mode.
110 
111  Remarks:
112  None.
113  */
114 typedef union leSchemeColorTable
115 {
116  struct
117  {
118  leColor base;
119  leColor highlight;
120  leColor highlightLight;
121  leColor shadow;
122  leColor shadowDark;
123  leColor foreground;
124  leColor foregroundInactive;
125  leColor foregroundDisabled;
126  leColor background;
127  leColor backgroundInactive;
128  leColor backgroundDisabled;
129  leColor text;
130  leColor textHighlight;
131  leColor textHighlightText;
132  leColor textInactive;
133  leColor textDisabled;
134  } colors;
135  leColor values[LE_SCHEME_COLOR_COUNT];
137 
138 /*
139  Enumeration:
140  leScheme
141 
142  Summary:
143  This structure specifies the style scheme components of an object.
144 
145  Description:
146  A scheme is a collection of colors that can be referenced by widgets
147  or other objects. While the color names strive to be intuitive they
148  aren't always used in the manner in which they describe.
149 
150  Remarks:
151  None.
152  */
153 typedef struct leScheme
154 {
155  leSchemeColorTable tables[LE_SCHEME_COLOR_MODE_COUNT];
156 } leScheme;
157 
158 extern const struct leScheme leDefaultScheme;
159 
160 // *****************************************************************************
161 // *****************************************************************************
162 // Section: Routines
163 // *****************************************************************************
164 // *****************************************************************************
165 
166 /* Function:
167  void leScheme_Initialize(leScheme* scheme)
168 
169  Summary:
170  Initialize the scheme to the default values as per the specified color mode.
171 
172  Description:
173  Initialize the scheme to the default values as per the specified color mode.
174 
175  Parameters:
176  leScheme* scheme - the scheme to modify
177 
178  Returns:
179  void
180 
181 */
192 void leScheme_Initialize(leScheme* scheme);
193 
206 leColor leScheme_GetColor(const leScheme* schm,
207  leSchemeColor clr,
208  leColorMode mode);
209 
221 leColor leScheme_GetRenderColor(const leScheme* schm,
222  leSchemeColor clr);
223 
224 #ifdef __cplusplus
225  }
226 #endif
227 
228 #endif // LEGATO_SCHEME_H
leSchemeColorTable
Definition: legato_scheme.h:115
leColorMode
leColorMode
This enum represents the supported RGB color formats.
Definition: legato_color.h:146
legato_color.h
Color definitions and functions.
legato_renderer.h
legato_scheme.h
Schemes support various properties that make it possible to customize the color of widgets.
leScheme
Definition: legato_scheme.h:154
leScheme_GetRenderColor
leColor leScheme_GetRenderColor(const leScheme *schm, leSchemeColor clr)
Gets a scheme render color for the current layer color mode.
Definition: legato_scheme.c:68
legato_common.h
Common macros and definitions used by Legato.
leScheme_GetColor
leColor leScheme_GetColor(const leScheme *schm, leSchemeColor clr, leColorMode mode)
Gets a scheme color.
Definition: legato_scheme.c:54
leScheme_Initialize
void leScheme_Initialize(leScheme *scheme)
Initialize scheme.
Definition: legato_scheme.c:46