Thanks @CallumSykes,
The āfill-darkā is working now but āstroke-darkā does not seem to work.
Iāve tried this way:
"collapse": {
# Default Icon
"default": f"""<?xml version="1.0" encoding="utf-8"?>
<svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" overflow="visible" xml:space="preserve" stroke-dark="{h_colors.get("bh_color")}">
<line fill="none" stroke-width="120" stroke-linecap="round" stroke-miterlimit="10" x1="256" y1="340.83" x2="86.34" y2="171.17"/>
<line fill="none" stroke-width="120" stroke-linecap="round" stroke-miterlimit="10" x1="256" y1="340.83" x2="425.66" y2="171.17"/></svg>""",
# Hover Icon
"hover": """<?xml version="1.0" encoding="utf-8"?>
<svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" overflow="visible" xml:space="preserve">
<line fill="none" stroke="#000000" stroke-width="120" stroke-linecap="round" stroke-miterlimit="10" x1="256" y1="340.83" x2="86.34" y2="171.17"/>
<line fill="none" stroke="#000000" stroke-width="120" stroke-linecap="round" stroke-miterlimit="10" x1="256" y1="340.83" x2="425.66" y2="171.17"/></svg>"""
And this way:
"collapse": {
# Default Icon
"default": f"""<?xml version="1.0" encoding="utf-8"?>
<svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" overflow="visible" xml:space="preserve">
<line fill="none" stroke-dark="{h_colors.get("bh_color")}" stroke-width="120" stroke-linecap="round" stroke-miterlimit="10" x1="256" y1="340.83" x2="86.34" y2="171.17"/>
<line fill="none" stroke-dark="{h_colors.get("bh_color")}" stroke-width="120" stroke-linecap="round" stroke-miterlimit="10" x1="256" y1="340.83" x2="425.66" y2="171.17"/></svg>""",
# Hover Icon
"hover": """<?xml version="1.0" encoding="utf-8"?>
<svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" overflow="visible" xml:space="preserve">
<line fill="none" stroke="#000000" stroke-width="120" stroke-linecap="round" stroke-miterlimit="10" x1="256" y1="340.83" x2="86.34" y2="171.17"/>
<line fill="none" stroke="#000000" stroke-width="120" stroke-linecap="round" stroke-miterlimit="10" x1="256" y1="340.83" x2="425.66" y2="171.17"/></svg>"""
},
Furthermore the dark-fill only works with this method:
Rhino.UI.ImageResources.CreateEtoIcon(string svgContents, int width, int height, bool adjustForDarkMode)
This method will not adjust the theme colors:
Rhino.UI.EtoExtensions.ToEto(Rhino.UI.DrawingUtilities.BitmapFromSvg(info_icon['default'], 512, 512, True)), # Default Icon (Dark Mode)
One other thing is switching to the CreateEtoIcon method is significantly slower to create the UI over the BitmapFromSvg method and also does not seem to have the anti-aliasing applied like the BitmapFromSvg method does. Time wise itās the difference of instant vs 2 seconds when more than 10 icons are present on screen
The svgs produced via CreateEtoIcon are jagged regardless of the size I set for them, is there an additional argument or setting I need to apply somewhere to prevent this?
Thanks for your help!