[Bf-blender-cvs] [dfd6bcf5003] filebrowser_redesign: UI: File Browser with Light Background
Harley Acheson
noreply at git.blender.org
Mon Aug 12 04:17:14 CEST 2019
Commit: dfd6bcf500307d2dfe4436a7873e0639a3668b07
Author: Harley Acheson
Date: Sun Aug 11 19:16:11 2019 -0700
Branches: filebrowser_redesign
https://developer.blender.org/rBdfd6bcf500307d2dfe4436a7873e0639a3668b07
UI: File Browser with Light Background
This uses dark icons if using a theme with light background
===================================================================
M release/scripts/addons
M source/blender/editors/space_file/file_draw.c
===================================================================
diff --git a/release/scripts/addons b/release/scripts/addons
index 802904cf43d..2fa8a6214fc 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 802904cf43da3deed2094520e17a79d8020d372a
+Subproject commit 2fa8a6214fc8c07cbaa4f07d134bf1cb5957210f
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index f2655b32e31..78f87f5e05e 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -178,7 +178,6 @@ static void file_draw_preview(uiBlock *block,
int ex, ey;
bool use_dropshadow = !is_icon &&
(typeflags & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_BLENDER));
- float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
BLI_assert(imb != NULL);
@@ -221,7 +220,20 @@ static void file_draw_preview(uiBlock *block,
GPU_blend(true);
/* the image */
- if (!is_icon && typeflags & FILE_TYPE_FTFONT) {
+
+ float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+ if (is_icon) {
+ /* Use dark icons 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;
+ }
+ }
+ else if (typeflags & FILE_TYPE_FTFONT) {
+ /* Use text color for font sample */
UI_GetThemeColor4fv(TH_TEXT, col);
}
More information about the Bf-blender-cvs
mailing list