Fix file/asset browser document type icons using wrong theme color
Steps to reproduce were: - Open File Browser, set it to Thumbnails display mode, disable filters - Navigate to a directory with documents that have no preview - Change Preferences > Themes > User Interface > Icon Colors > File Folders to light and dark colors - See how the type icons on top of the white document icon image get changed unexpectedly. Only type icons drawn on top of folder icon images should change. When drawing the document type icons on top of the folder or document image in the center of thumbnails, they would always use the folder icon color (Preferences > Themes > User Interface > Icon Colors > File Folders) to determine if they should be drawn with a light or a dark color. It should only use that when drawing on top of a folder icon image, and the color for document icon images otherwise.
This commit is contained in:
@@ -405,21 +405,21 @@ static void file_draw_preview(const FileDirEntry *file,
|
||||
|
||||
/* the large image */
|
||||
|
||||
float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
float document_img_col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
if (is_icon) {
|
||||
if (file->typeflag & FILE_TYPE_DIR) {
|
||||
UI_GetThemeColor4fv(TH_ICON_FOLDER, col);
|
||||
UI_GetThemeColor4fv(TH_ICON_FOLDER, document_img_col);
|
||||
}
|
||||
else {
|
||||
UI_GetThemeColor4fv(TH_TEXT, col);
|
||||
UI_GetThemeColor4fv(TH_TEXT, document_img_col);
|
||||
}
|
||||
}
|
||||
else if (file->typeflag & FILE_TYPE_FTFONT) {
|
||||
UI_GetThemeColor4fv(TH_TEXT, col);
|
||||
UI_GetThemeColor4fv(TH_TEXT, document_img_col);
|
||||
}
|
||||
|
||||
if (dimmed) {
|
||||
col[3] *= 0.3f;
|
||||
document_img_col[3] *= 0.3f;
|
||||
}
|
||||
|
||||
if (!is_icon && file->typeflag & FILE_TYPE_BLENDERLIB) {
|
||||
@@ -440,7 +440,7 @@ static void file_draw_preview(const FileDirEntry *file,
|
||||
scale,
|
||||
1.0f,
|
||||
1.0f,
|
||||
col);
|
||||
document_img_col);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
@@ -450,9 +450,7 @@ static void file_draw_preview(const FileDirEntry *file,
|
||||
const float icon_size = 16.0f / icon_aspect * UI_SCALE_FAC;
|
||||
float icon_opacity = 0.3f;
|
||||
uchar icon_color[4] = {0, 0, 0, 255};
|
||||
float bgcolor[4];
|
||||
UI_GetThemeColor4fv(TH_ICON_FOLDER, bgcolor);
|
||||
if (rgb_to_grayscale(bgcolor) < 0.5f) {
|
||||
if (rgb_to_grayscale(document_img_col) < 0.5f) {
|
||||
icon_color[0] = 255;
|
||||
icon_color[1] = 255;
|
||||
icon_color[2] = 255;
|
||||
|
||||
Reference in New Issue
Block a user