hidpi/dark images in Plugins
Oxygen general issues.
-
- Posts: 9436
- Joined: Fri Jul 09, 2004 5:18 pm
Re: hidpi/dark images in Plugins
Hi Patrick,
So let's say your plugin adds a new toolbar button with your custom image.
Somewhere in an "images" folder you have an image called let's say myImage.png which you currently use for that button.
Besides that image in the same folder you should have another image called myImagee@2x.png which should be twice as large as the original image (both vertically and horizontally). This image will be used for Mac Retina displays for example.
And you should also create and have in the same folder the equivalent images to be used for the dark themes: myImage_dark.png and myImage_dark@2x.png.
Then you can use our API ro.sync.ui.Icons.getIcon(String iconKey). The icon key should be an URL pointing to the original image myImage.png. Depending on whether Oxygen is running in retina display with or without dark theme, the API will load either the original image or one of the other images located in the same place.
If you do not want to manually create the dark image, we have an API which would allow you to check if Oxygen is running in dark mode:
WorkspaceUtilities.getColorTheme()
and we also have an image inverter API:
WorkspaceUtilities.getImageInverter()
but for supporting hidpi you will need to create the larger icon by yourself.
Regards,
Radu
So let's say your plugin adds a new toolbar button with your custom image.
Somewhere in an "images" folder you have an image called let's say myImage.png which you currently use for that button.
Besides that image in the same folder you should have another image called myImagee@2x.png which should be twice as large as the original image (both vertically and horizontally). This image will be used for Mac Retina displays for example.
And you should also create and have in the same folder the equivalent images to be used for the dark themes: myImage_dark.png and myImage_dark@2x.png.
Then you can use our API ro.sync.ui.Icons.getIcon(String iconKey). The icon key should be an URL pointing to the original image myImage.png. Depending on whether Oxygen is running in retina display with or without dark theme, the API will load either the original image or one of the other images located in the same place.
If you do not want to manually create the dark image, we have an API which would allow you to check if Oxygen is running in dark mode:
WorkspaceUtilities.getColorTheme()
and we also have an image inverter API:
WorkspaceUtilities.getImageInverter()
but for supporting hidpi you will need to create the larger icon by yourself.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9436
- Joined: Fri Jul 09, 2004 5:18 pm
Re: hidpi/dark images in Plugins
One more thing:
A similar procedure is done if you have a framework and use in the CSS various icons:
https://www.oxygenxml.com/doc/versions/ ... mages.html
Regards,
Radu
A similar procedure is done if you have a framework and use in the CSS various icons:
https://www.oxygenxml.com/doc/versions/ ... mages.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service