Skip to content

Commit

Permalink
add remaining colors to theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nakst committed Oct 28, 2023
1 parent f33c563 commit 6a1b692
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
7 changes: 4 additions & 3 deletions gf2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,15 @@ bool INIParse(INIState *s) {

int ModifiedRowMessage(UIElement *element, UIMessage message, int di, void *dp) {
if (message == UI_MSG_PAINT) {
UIDrawBorder((UIPainter *) dp, element->bounds, 0x00FF00, UI_RECT_1(2));
UIDrawBorder((UIPainter *) dp, element->bounds, ui.theme.selected, UI_RECT_1(2));
}

return 0;
}

int TrafficLightMessage(UIElement *element, UIMessage message, int di, void *dp) {
if (message == UI_MSG_PAINT) {
UIDrawRectangle((UIPainter *) dp, element->bounds, programRunning ? 0xFF0000 : 0x00FF00, ui.theme.border, UI_RECT_1(1));
UIDrawRectangle((UIPainter *) dp, element->bounds, programRunning ? ui.theme.accent1 : ui.theme.accent2, ui.theme.border, UI_RECT_1(1));
}

return 0;
Expand Down Expand Up @@ -1161,7 +1161,8 @@ void CommandDonate(void *) {
const char *themeItems[] = {
"panel1", "panel2", "selected", "border", "text", "textDisabled", "textSelected",
"buttonNormal", "buttonHovered", "buttonPressed", "buttonDisabled", "textboxNormal", "textboxFocused",
"codeFocused", "codeBackground", "codeDefault", "codeComment", "codeString", "codeNumber", "codeLineNumber", "codeOperator", "codePreprocessor",

This comment has been minimized.

Copy link
@s4my

s4my Oct 28, 2023

Contributor

By removing codeLineNumber you render porting any theme/scheme that has different color for line numbers and comments (and a lot of them do) impossible. You should probably google like vim color schemes and look for those that don't have the same color for color numbers and commets to see what am talking about.

This comment has been minimized.

Copy link
@nakst

nakst Oct 29, 2023

Owner

I know, but my aim is to keep it as simple as possible for people to develop new themes. Less colors = easier to make a theme. There used to be many more individually controllable theme colors, but it was a pain to work with them. This is why I am very hesitant to add new colors.

"codeFocused", "codeBackground", "codeDefault", "codeComment", "codeString", "codeNumber", "codeOperator", "codePreprocessor",
"accent1", "accent2",
};

void SettingsAddTrustedFolder() {
Expand Down
13 changes: 9 additions & 4 deletions luigi2.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ typedef struct UITheme {
uint32_t text, textDisabled, textSelected;
uint32_t buttonNormal, buttonHovered, buttonPressed, buttonDisabled;
uint32_t textboxNormal, textboxFocused;
uint32_t codeFocused, codeBackground, codeDefault, codeComment, codeString, codeNumber, codeLineNumber, codeOperator, codePreprocessor;
uint32_t codeFocused, codeBackground, codeDefault, codeComment, codeString, codeNumber, codeOperator, codePreprocessor;
uint32_t accent1, accent2;
} UITheme;

typedef struct UIPainter {
Expand Down Expand Up @@ -923,9 +924,11 @@ UITheme uiThemeClassic = {
.codeComment = 0xFFA11F20,
.codeString = 0xFF037E01,
.codeNumber = 0xFF213EF1,
.codeLineNumber = 0xFFA11F20,
.codeOperator = 0xFF7F0480,
.codePreprocessor = 0xFF545D70,

.accent1 = 0xFF0000,
.accent2 = 0x00FF00,
};

UITheme uiThemeDark = {
Expand All @@ -952,9 +955,11 @@ UITheme uiThemeDark = {
.codeComment = 0xFFB4B4B4,
.codeString = 0xFFF5DDD1,
.codeNumber = 0xFFC3F5D3,
.codeLineNumber = 0xFFB4B4B4,
.codeOperator = 0xFFF5D499,
.codePreprocessor = 0xFFF5F3D1,

.accent1 = 0xF01231,
.accent2 = 0x45F94E,
};

/////////////////////////////////////////
Expand Down Expand Up @@ -2836,7 +2841,7 @@ int _UICodeMessage(UIElement *element, UIMessage message, int di, void *dp) {
}

UIDrawString(painter, marginBounds, string + p, 16 - p,
marginColor ? ui.theme.codeDefault : ui.theme.codeLineNumber, UI_ALIGN_RIGHT, NULL);
marginColor ? ui.theme.codeDefault : ui.theme.codeComment, UI_ALIGN_RIGHT, NULL);
}

if (code->focused == i) {
Expand Down
6 changes: 3 additions & 3 deletions windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ int DisplayCodeMessage(UIElement *element, UIMessage message, int di, void *dp)

for (int i = 0; i < breakpoints.Length(); i++) {
if (breakpoints[i].line == di && 0 == strcmp(breakpoints[i].fileFull, currentFileFull)) {
if (breakpoints[i].enabled) return 0xFF0000;
if (breakpoints[i].enabled) return ui.theme.accent1;
else atLeastOneBreakpointDisabled = true;
}
}

if (atLeastOneBreakpointDisabled) {
return 0x822454;
return (((ui.theme.accent1 & 0xFF0000) >> 1) & 0xFF0000) | (((ui.theme.accent1 & 0xFF00) >> 1) & 0xFF00) | ((ui.theme.accent1 & 0xFF) >> 1);
}
} else if (message == UI_MSG_PAINT) {
element->messageClass(element, message, di, dp);
Expand All @@ -363,7 +363,7 @@ int DisplayCodeMessage(UIElement *element, UIMessage message, int di, void *dp)
if (UICodeHitTest((UICode *) element, element->window->cursorX, element->window->cursorY) == m->index
&& element->window->hovered == element && (element->window->ctrl || element->window->alt || element->window->shift)
&& !element->window->textboxModifiedFlag) {
UIDrawBorder(m->painter, m->bounds, element->window->ctrl ? 0xFF6290E0 : 0xFFE09062, UI_RECT_1(2));
UIDrawBorder(m->painter, m->bounds, element->window->ctrl ? ui.theme.selected : ui.theme.codeOperator, UI_RECT_1(2));
UIDrawString(m->painter, m->bounds, element->window->ctrl ? "=> run until " : "=> skip to ", -1, ui.theme.text, UI_ALIGN_RIGHT, NULL);
} else if (m->index == currentEndOfBlock) {
UIDrawString(m->painter, m->bounds, "[Shift+F10]", -1, ui.theme.codeComment, UI_ALIGN_RIGHT, NULL);
Expand Down

0 comments on commit 6a1b692

Please sign in to comment.