Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit d7aeb55

Browse files
authored
Merge pull request #15 from Jack-Punter/BraceHighlightTweaks
BraceAnnotation and BraceLine Color Cycle
2 parents 1cf792e + 62925c5 commit d7aeb55

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

4coder_fleury_brace.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ F4_Brace_RenderCloseBraceAnnotation(Application_Links *app, Buffer_ID buffer, Te
151151
// NOTE(rjf): Draw.
152152
if(start_token)
153153
{
154-
ARGB_Color color = F4_ARGBFromID(active_color_table, fleury_color_brace_annotation, 0);
154+
ARGB_Color color = finalize_color(defcolor_comment, 0);
155+
Color_Array colors = finalize_color_array(fleury_color_brace_annotation);
156+
if (colors.count >= 1 && F4_ARGBIsValid(colors.vals[0])) {
157+
color = colors.vals[(ranges.count - i - 1) % colors.count];
158+
}
159+
155160
String_Const_u8 start_line = push_buffer_line(app, scratch, buffer,
156161
get_line_number_from_pos(app, buffer, start_token->pos));
157162

@@ -286,8 +291,12 @@ F4_Brace_RenderLines(Application_Links *app, Buffer_ID buffer, View_ID view,
286291
line_rect.x1 = x_position+1+x_offset;
287292
line_rect.y0 = y_start;
288293
line_rect.y1 = y_end;
289-
u32 color = F4_ARGBFromID(active_color_table, fleury_color_brace_line);
290-
draw_rectangle(app, line_rect, 0.5f, color);
294+
295+
Color_Array colors = finalize_color_array(fleury_color_brace_line);
296+
if (colors.count >= 1 && F4_ARGBIsValid(colors.vals[0])) {
297+
draw_rectangle(app, line_rect, 0.5f,
298+
colors.vals[(ranges.count - i - 1) % colors.count]);
299+
}
291300
}
292301
}
293302
}

0 commit comments

Comments
 (0)