mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 06:27:01 +01:00
add icon mapping file for php
This commit is contained in:
@@ -48,15 +48,27 @@ export class IconsSelector {
|
|||||||
|
|
||||||
""");
|
""");
|
||||||
|
|
||||||
# write documentation file
|
# write mapping lib for python
|
||||||
#with open(os.path.join(__location__, "../..","icons.md"), 'w') as f:
|
with open(os.path.join(__location__, "../../../ip-symcon", "icon_mapping.php"), 'w') as f:
|
||||||
# f.write("""
|
f.write("$icons = [\n")
|
||||||
## Icons IDs
|
for icon in icon_metadata:
|
||||||
#This file contains the Icons IDs included in the display firmware, addressable via serial.
|
iconchar = chr(int(icon['hex'], 16))
|
||||||
#
|
name = icon["name"]
|
||||||
#MD Icon Name | Icon
|
f.write(f" \"{name}\" => \"{iconchar}\",\n")
|
||||||
#------------ | ----
|
f.write("];\n")
|
||||||
#""")
|
f.write("""
|
||||||
# for icon in icon_metadata:
|
|
||||||
# val = icon["name"]
|
function get_icon($name) {
|
||||||
# f.write(f"mdi:{val} | \n")
|
global $icons;
|
||||||
|
if (str_contains('text:', $name)) {
|
||||||
|
return str_replace('text:', "", $name);
|
||||||
|
}
|
||||||
|
$ma_name = str_replace('mdi:', "", $name);
|
||||||
|
if (array_key_exists($ma_name, $icons)) {
|
||||||
|
return $icons[$ma_name];
|
||||||
|
}else{
|
||||||
|
return $icons["alert-circle-outline"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
""")
|
||||||
6914
ip-symcon/icon_mapping.php
Normal file
6914
ip-symcon/icon_mapping.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user