diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2019-09-10 18:07:39 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2019-09-10 18:07:39 +0300 |
commit | 8f55794c0e803ec5454febe2e45651c721f62c8f (patch) | |
tree | d72ee691ad669096d7f86e498560631cccadb515 /source/blender/editors/space_file/file_draw.c | |
parent | a3e7440cfdd2f307e5c57922fd22e8770f0b8390 (diff) |
UI: File Browser Custom Folder Color
Allows file browser folders to be shown in a theme-selectable color, default of manila.
Differential Revision: https://developer.blender.org/D5713
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/editors/space_file/file_draw.c')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index ca26a56a26e..0aec6d5e6a0 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -138,13 +138,10 @@ static void file_draw_icon( { uiBut *but; int x, y; - // float alpha = 1.0f; x = sx; y = sy - height; - /*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/ - but = uiDefIconBut( block, UI_BTYPE_LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, NULL); UI_but_func_tooltip_set(but, file_draw_tooltip_func, BLI_strdup(path)); @@ -265,15 +262,11 @@ static void file_draw_preview(uiBlock *block, float col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; if (is_icon) { - /* File and Folder icons draw with lowered opacity until we add themes */ - col[3] = 0.6f; - /* Use dark images if background is light */ - float bg[3]; - UI_GetThemeColor3fv(TH_BACK, bg); - if (rgb_to_grayscale(bg) > 0.5f) { - col[0] = 0; - col[1] = 0; - col[2] = 0; + if (typeflags & FILE_TYPE_DIR) { + UI_GetThemeColor4fv(TH_ICON_FOLDER, col); + } + else { + UI_GetThemeColor4fv(TH_TEXT, col); } } else if (typeflags & FILE_TYPE_FTFONT) { @@ -314,7 +307,7 @@ static void file_draw_preview(uiBlock *block, float icon_opacity = 0.3f; uchar icon_color[4] = {0, 0, 0, 255}; float bgcolor[4]; - UI_GetThemeColor4fv(TH_TEXT, bgcolor); + UI_GetThemeColor4fv(TH_ICON_FOLDER, bgcolor); if (rgb_to_grayscale(bgcolor) < 0.5f) { icon_color[0] = 255; icon_color[1] = 255; |