UI: Color Icon Theme Internal Parts #125146
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#125146
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Harley/blender:IconThemeColor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Allow color SVG icons to have their fill colors modified by theme
colors using a callback. This is done just before rasterization so
only happens once per requested size, before these are cached for
reuse.
As an example this PR alters "record_on.svg" slightly so that, only if it is defined as DEF_ICON_COLOR, it will display its inner circle in red, while the outer ring will show in the current text color and so changing with theme changes:
While in dark mode it would look like this:
While in light mode you notice that the outer ring color is different:
This PR leaves "ICON_RECORD_ON" defined as just DEF_ICON and therefore it looks and behaves as it does currently.
c96caf2e4a
to4ed805e53a
@ -109,2 +111,3 @@
float outline_alpha = 1.0f,
bool multicolor = false);
bool multicolor = false,
std::function<void(std::string &)> edit_source_cb = nullptr);
FunctionRef
would be a better fit here.std::function
is only used when it needs to own data (i.e. the function is passed around and saved for later).@ -1296,2 +1298,4 @@
}
static void svg_replace_color_attributes(std::string &svg,
const std::string name,
Pass
std::string
by const reference rather than by value.Generally I'm a bit concerned by the performance of this function when it starts acting on thousands of icons. There are a lot of incremental updates to the text, and then it's called once for every theme color.
I don't want to get in the way or request premature optimizations, but I'd just suggest keeping an eye on this as more SVG icons are processed with this function. It shouldn't have an impact on startup time for example.
Agreed. I'll add a "Todo" comment to
icon_source_edit_cb
indicating that this text processing is suboptimal with all the inserts and has lots of room for optimization.Actually re-wrote that section so the processing is done by scanning the string by group, only for those that start with "blender."
@ -1298,0 +1336,4 @@
};
for (const ColorItem &item : items) {
if (name.compare(item.name) != 0) {
Why not just
name != item.name
?@ -1298,0 +1365,4 @@
if (att_start == std::string::npos || att_start > end) {
break;
}
const size_t att_end = svg.find("\"", att_start + 6);
These numbers 6, 20, 14, 16, should come from somewhere. I imagine they're the length of some string? Probably better to compute it at compile time then. For example with
StringRef::size()
.@blender-bot build