Icon
The icon command renders a single ".icn" file that can be created locally on your account or pulled from the system.
Functionality
The icon command allows you to display icons within your OSL application. These icons can be sourced from files in the system's Icons folder, specified by their names, or created using raw icon data directly within the command.
Syntax
Parameters
"code/name"
: Specifies the name of the icon file or provides raw icon code for rendering.size
: Sets the multiplier for the size of the icon to be rendered. (1 indicates the original size of the icon)
Color Modifier
You can modify the color of the icon using a modifier syntax:
Icon Creation Recommendations
It's recommended to keep all icon data inside the application and avoid referencing locally created icons. This ensures consistent access to icons across different users.
Examples
Display an icon named "my_icon" with a size multiplier of 1:
Draw an "X" icon using raw icon code and set its size to 2:
Display an icon using an array of icon data and set its color to white (#fff):
Notes
Ensure that icon files are accessible to all users by storing them within the application rather than locally.
In this example:
We define an icon code as a variable named
my_icon_code
.The icon code is specified as an array containing instructions to draw the icon.
Later, we use the
icon
command and pass themy_icon_code
variable as the icon data. We also set the size multiplier to2
to make the icon larger.
This approach allows you to store icon data directly within your application's script, ensuring accessibility to all users without relying on external files or resources.
Last updated
Was this helpful?