Hello,
Prior to 8.14, the Rhino.UI.DrawingUtilities.BitmapFromSvg
would ensure that a bitmap derived from SVG code with adjustForDarkMode
enabled would modify the SVG fill/stroke color to properly lighten or darken based on the Rhino Theme.
This no longer is working, the adjustForDarkMode value seems to have no effect whatsoever now. Please see the simplified code below to repeat this.
Unfortunately, this bugs out our entire UI as a result since all our icons/buttons rely on SVG to Bitmap and dynamic theme switching support.
Thanks for your help! @CallumSykes @wim @Gijs
System Info
Rhino 8 SR14 2024-11-12 (Rhino 8, 8.14.24317.14001, Git hash:master @ 69ab12ed53cf1e6d17f23ab5fec3c3f7216df72d)
License type: Commercial, build 2024-11-12
License details: Cloud Zoo
Windows 11 (10.0.22631 SR0.0) or greater (Physical RAM: 64GB)
.NET 7.0.20
Computer platform: LAPTOP - Plugged in [98% battery remaining]
Standard graphics configuration.
Primary display: DisplayLink USB Device (DisplayLink) Memory: 0MB, Driver date: 2-9-2024 (M-D-Y).
> External USB display device with 4 adapter port(s)
- Windows Main Display attached to adapter port 0
- Secondary monitor attached to adapter port 1
Primary OpenGL: NVIDIA GeForce RTX 3080 Ti Laptop GPU (NVidia) Memory: 16GB, Driver date: 1-15-2023 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 528.24
> Integrated accelerated graphics device with 4 adapter port(s)
- Video pass-through to primary display device
Secondary graphics devices.
Intel(R) Iris(R) Xe Graphics (Intel) Memory: 1GB, Driver date: 10-26-2022 (M-D-Y).
> Integrated graphics device with 4 adapter port(s)
- There are no monitors attached to this device. Laptop lid is probably closed
DisplayLink USB Device (DisplayLink) Memory: 0MB, Driver date: 2-9-2024 (M-D-Y).
> External USB display device with 0 adapter port(s)
- There are no monitors attached to this device. Laptop lid is probably closed
OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
GPU Tessellation is: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPUâs maximum)
Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High
Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 1-15-2023
Driver Version: 31.0.15.2824
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 16 GB
Rhino plugins that do not ship with Rhino
C:\ProgramData\McNeel\Rhinoceros\7.0\Plug-ins\Datasmith Rhino Exporter (d1fdc795-b334-4933-b680-088119cdc6bb)\DatasmithRhino7.rhp âDatasmith Exporterâ 5.1.0.0
C:\Program Files\Enscape\Enscape.Rhino.Plugin-net48\Enscape.Rhino8.Plugin.dll âEnscape.Rhino8.Pluginâ 4.1.1.35
C:\Users\micha\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\doodle\0.1.1-beta+9085\doodle.rhp âdoodleâ 0.0.0.0
C:\Users\micha\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Crash\1.4.2-beta\Crash.rhp âCrashâ 1.4.0.0
C:\Users\micha\AppData\Roaming\McNeel\Rhinoceros\8.0\Plug-ins\D5LiveSync (e0d5e210-02f6-4ee9-a2b0-1675e225d958)\D5Conv.rhp âD5 Live Sync for Rhinoâ
Rhino plugins that ship with Rhino
C:\Program Files\Rhino 8\Plug-ins\Commands.rhp âCommandsâ 8.14.24317.14001
C:\Program Files\Rhino 8\Plug-ins\rdk.rhp âRenderer Development Kitâ
C:\Program Files\Rhino 8\Plug-ins\RhinoRenderCycles.rhp âRhino Renderâ 8.14.24317.14001
C:\Program Files\Rhino 8\Plug-ins\rdk_etoui.rhp âRDK_EtoUIâ 8.14.24317.14001
C:\Program Files\Rhino 8\Plug-ins\NamedSnapshots.rhp âSnapshotsâ
C:\Program Files\Rhino 8\Plug-ins\MeshCommands.rhp âMeshCommandsâ 8.14.24317.14001
C:\Program Files\Rhino 8\Plug-ins\RhinoCycles.rhp âRhinoCyclesâ 8.14.24317.14001
C:\Program Files\Rhino 8\Plug-ins\Grasshopper\GrasshopperPlugin.rhp âGrasshopperâ 8.14.24317.14001
C:\Program Files\Rhino 8\Plug-ins\RhinoCode\RhinoCodePlugin.rhp âRhinoCodePluginâ 8.14.24317.14001
C:\Program Files\Rhino 8\Plug-ins\Toolbars\Toolbars.rhp âToolbarsâ 8.14.24317.14001
C:\Program Files\Rhino 8\Plug-ins\3dxrhino.rhp â3Dconnexion 3D Mouseâ
C:\Program Files\Rhino 8\Plug-ins\Displacement.rhp âDisplacementâ
C:\Program Files\Rhino 8\Plug-ins\SectionTools.rhp âSectionToolsâ
#! python3
import Rhino
import Eto
class UI():
# Set the color values for all buttons
h_colors = {
"bh_color": "#F0F0F0",
"info": "#D3D3D3"
}
misc_icons = {
# Info Icons
"info": {
# Default Icon
"default": """<?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">
<path d="M257,199.29L257,199.29c-27.78,0-50.3,22.52-50.3,50.3v158.3c0,27.78,22.52,50.3,50.3,50.3h0
c27.78,0,50.3-22.52,50.3-50.3v-158.3C307.3,221.81,284.78,199.29,257,199.29z"/>
<path d="M256,55.41L256,55.41c-27.78,0-50.3,22.52-50.3,50.3v0c0,27.78,22.52,50.3,50.3,50.3h0
c27.78,0,50.3-22.52,50.3-50.3v0C306.3,77.94,283.78,55.41,256,55.41z"/></svg>""",
# Hover Icon
"hover": 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">
<path fill="{h_colors.get("info")}" d="M257,199.29L257,199.29c-27.78,0-50.3,22.52-50.3,50.3v158.3c0,27.78,22.52,50.3,50.3,50.3h0
c27.78,0,50.3-22.52,50.3-50.3v-158.3C307.3,221.81,284.78,199.29,257,199.29z"/>
<path fill="{h_colors.get("info")}" d="M256,55.41L256,55.41c-27.78,0-50.3,22.52-50.3,50.3v0c0,27.78,22.52,50.3,50.3,50.3h0
c27.78,0,50.3-22.52,50.3-50.3v0C306.3,77.94,283.78,55.41,256,55.41z"/></svg>"""
}
}
# Draw the image
info_icon = UI.misc_icons.get("info") # Get the svg code for the icon
# Rhino.UI.EtoExtensions.ToEto(Rhino.UI.DrawingUtilities.BitmapFromSvg(info_icon['hover'], 512, 512, False)), # Hover Icon
bitmap = Rhino.UI.EtoExtensions.ToEto(Rhino.UI.DrawingUtilities.BitmapFromSvg(info_icon['default'], 512, 512, True)) # Default Icon (Dark Mode)
# Rhino.UI.EtoExtensions.ToEto(Rhino.UI.DrawingUtilities.BitmapFromSvg(info_icon['default'], 512, 512)), # Default Icon (Light Mode)
image_control = Eto.Forms.Button()
image_control.Image = bitmap
form = Eto.Forms.Form()
form.Size = Eto.Drawing.Size(400, 400)
layout = Eto.Forms.DynamicLayout()
layout.AddRow(image_control)
form.Content = layout
form.Show()
EDIT: This seems to also effect this method:
Rhino.UI.ImageResources.CreateEtoIcon(info_icon['default'], 512, 512, False)
Is there something different as of 8.14 that I need to add into my SVG code for this to work? This seems like a bug/regression to me.
Thanks!