Project

General

Profile

Actions

Feature #43087

open

Allow to change icons sprites from theme

Added by Catirau Mihail 7 months ago. Updated 2 days ago.

Status:
Resolved
Priority:
Normal
Category:
Themes
Target version:
Resolution:
Fixed

Description

Allow to change icons sprites from themes

It will be great to have a option to replace sprites icons.svg from active theme

module IconsHelper

# ...

  include Redmine::Themes::Helper

  def sprite_source(sprite: DEFAULT_SPRITE, plugin: nil)
    if plugin
      "plugin_assets/#{plugin}/#{sprite}.svg" 
    elsif current_theme && current_theme.images.include?("#{sprite}.svg")
      current_theme.image_path("#{sprite}.svg")
    else
      "#{sprite}.svg" 
    end
  end

  def sprite_icon(icon_name, label = nil, icon_only: false, size: DEFAULT_ICON_SIZE, style: :outline, css_class: nil, sprite: DEFAULT_SPRITE, plugin: nil, rtl: false)
    sprite = sprite_source(sprite: sprite, plugin: plugin)

    # ...
  end

# ...

end

Files

icons_helper.rb (4.04 KB) icons_helper.rb Catirau Mihail, 2025-08-01 14:59
43087.patch (1.01 KB) 43087.patch Go MAEDA, 2025-08-02 09:59
test-for-43087.patch (1.84 KB) test-for-43087.patch Marius BĂLTEANU, 2026-02-03 03:04
0001-Allow-to-change-icons-sprite-from-theme-with-a-fallb.patch (9.03 KB) 0001-Allow-to-change-icons-sprite-from-theme-with-a-fallb.patch Marius BĂLTEANU, 2026-02-04 04:14
Actions

Also available in: Atom PDF