feat: allow to add background colors for icon

This commit is contained in:
sokumon 2026-01-27 18:21:21 +05:30
parent ede5a62fb3
commit 104a5c04bd
4 changed files with 11 additions and 6 deletions

View file

@ -23,6 +23,7 @@
"link",
"hidden",
"restrict_removal",
"bg_color",
"roles_tab",
"roles"
],
@ -141,10 +142,16 @@
"fieldname": "restrict_removal",
"fieldtype": "Check",
"label": "Restrict Removal"
},
{
"fieldname": "bg_color",
"fieldtype": "Select",
"label": "Background Color",
"options": "blue\ngray"
}
],
"links": [],
"modified": "2026-01-25 15:29:33.884930",
"modified": "2026-01-27 18:17:48.667070",
"modified_by": "Administrator",
"module": "Desk",
"name": "Desktop Icon",

View file

@ -24,6 +24,7 @@ class DesktopIcon(Document):
from frappe.types import DF
app: DF.Autocomplete | None
bg_color: DF.Literal["blue", "gray"]
hidden: DF.Check
icon_image: DF.Attach | None
icon_type: DF.Literal["Link", "Folder", "App"]
@ -147,6 +148,7 @@ def get_desktop_icons(user=None, bootinfo=None):
if not user_icons:
fields = [
"label",
"bg_color",
"link",
"link_type",
"app",

View file

@ -12,7 +12,7 @@
</div>
{% } else { %}
{%= frappe.utils.desktop_icon(icon.label,"gray")%}
{%= frappe.utils.desktop_icon(icon.label, icon.bg_color || "gray") %}
{% } %}
{% if (!in_folder) { %}
<div class="icon-caption">

View file

@ -1389,10 +1389,6 @@ Object.assign(frappe.utils, {
blue: "#0981E3",
gray: "#7B808A",
},
desktop_bg_color(color_name) {
let color_value = this.desktop_pallete[color_name];
color_value + "";
},
icon(
icon_name,
size = "sm",