summaryrefslogtreecommitdiff
path: root/colors.c
diff options
context:
space:
mode:
Diffstat (limited to 'colors.c')
-rw-r--r--colors.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/colors.c b/colors.c
index a6c72c6..bc46d52 100644
--- a/colors.c
+++ b/colors.c
@@ -1,6 +1,8 @@
+#include "ted.h"
+
typedef struct {
ColorSetting setting;
- char const *name;
+ const char *name;
} ColorName;
static ColorName const color_names[] = {
@@ -55,7 +57,7 @@ static ColorName const color_names[] = {
static_assert_if_possible(arr_count(color_names) == COLOR_COUNT)
-static ColorSetting color_setting_from_str(char const *str) {
+ColorSetting color_setting_from_str(const char *str) {
// @OPTIMIZE: sort color_names, binary search
for (int i = 0; i < COLOR_COUNT; ++i) {
ColorName const *n = &color_names[i];
@@ -65,7 +67,7 @@ static ColorSetting color_setting_from_str(char const *str) {
return COLOR_UNKNOWN;
}
-static char const *color_setting_to_str(ColorSetting s) {
+const char *color_setting_to_str(ColorSetting s) {
for (int i = 0; i < COLOR_COUNT; ++i) {
ColorName const *n = &color_names[i];
if (n->setting == s)
@@ -75,7 +77,7 @@ static char const *color_setting_to_str(ColorSetting s) {
}
// converts #rrggbb/#rrggbbaa to a color. returns false if it's not in the right format.
-static Status color_from_str(char const *str, u32 *color) {
+Status color_from_str(const char *str, u32 *color) {
uint r = 0, g = 0, b = 0, a = 0xff;
bool success = false;
switch (strlen(str)) {
@@ -108,7 +110,7 @@ static Status color_from_str(char const *str, u32 *color) {
}
-static ColorSetting color_for_symbol_kind(SymbolKind kind) {
+ColorSetting color_for_symbol_kind(SymbolKind kind) {
switch (kind) {
case SYMBOL_CONSTANT:
return COLOR_CONSTANT;