Texture in LSS
In LDLib2, many visual styles (such as background) accept a texture value.
Texture values in LSS are string-based expressions that describe how a texture is created and optionally transformed.
This system is flexible and composable, allowing you to build complex visuals using a concise syntax.
Supported Texture Types
Empty Texture
or an empty string:
This results in no texture being rendered.
Solid Color
If the value can be parsed as a color, it will be treated as a color rectangle:
background: #1F00FFFF; /* #AARRGGBB */
background: #FF00FF; //* #RRGGBB */
background: #FFF; /* #RGB */
background: rgba(255, 0, 0, 128);
background: rgb(255, 123, 0);
sprite(...)
Uses a sprite from a texture atlas or resource location.
Advanced usage:
background: sprite(
ldlib2:textures/gui/icon.png,
0, 0, 16, 16, /* sprite region (optional) */
2, 2, 2, 2, /* border (opional) */
#FFFFFF /* color tint (optional) */
);
icon(...)
Uses a registered icon texture.
rect(...) / sdf(...)
Creates an SDF-based rectangle texture.
background: rect(#FF0000);
background: rect(#FF0000, 4);
background: rect(#FF0000, 4 4 4 4, 2, #FFFFFF);
Arguments:
- Fill color
- Corner radius (single value or 4 values) (optional)
- Stroke width (optional)
- Border color (optional)
border(...)
Creates a simple colored border.
group(...)
Combines multiple textures into a single group.
shader(...)
Uses a custom shader texture.
Resource-based Textures
If the function name matches a registered resource provider type, it will be resolved automatically:
This allows integration with LDLib2’s resource system.
Texture Transforms
After the main texture, you can apply transform functions.
Scale
Rotate
Translate
Color Override
This tints the texture using the given color.
In summary, LSS texture values let you:
- Define textures declaratively
- Chain transforms in a readable way
- Reuse and override visuals efficiently
This makes UI styling both powerful and resource-pack friendly.