Custom Style Parameters
Override element styles dynamically using custom style parameters in Orshot Studio
Custom Style Parameters allow you to dynamically override individual CSS properties of parameterized elements at render time. While regular parameters control content (text, images), style parameters give you precise control over visual properties like colors, fonts, sizes, and more
Video Tutorial
How It Works
Custom style parameters use a dot notation format: parameterId.property
For example:
title.fontSize
- Changes the font size of a text element with parameter ID "title"logo.borderRadius
- Changes the border radius of an image element with parameter ID "logo"badge.fill
- Changes the fill color of a shape element with parameter ID "badge"
Syntax Format
Single Page Templates
Multi-Page Templates
For multi-page templates, use the page prefix:
Supported Properties
Text Elements
Typography
fontSize
- Font size (e.g., "24px", "2rem")fontWeight
- Font weight (e.g., "bold", "400", "700")fontStyle
- Font style (e.g., "italic", "normal")fontFamily
- Font family (Google Fonts supported)lineHeight
- Line height (e.g., "1.5", "24px")letterSpacing
- Letter spacing (e.g., "0.05em", "2px")
Alignment & Decoration
textAlign
- Text alignment ("left", "center", "right")verticalAlign
- Vertical alignment ("top", "middle", "bottom")textDecoration
- Text decoration ("underline", "none")textTransform
- Text transform ("uppercase", "lowercase", "capitalize")
Colors & Effects
color
- Text color (e.g., "#ff0000", "rgba(255, 0, 0, 0.5)")backgroundColor
(orbackground
,bgColor
,bg
) - Text background colorbackgroundRadius
(orbgRadius
) - Text background border radiustextStrokeWidth
- Stroke width (e.g., "2px")textStrokeColor
- Stroke color
Shadows & Effects
dropShadowX
- Shadow horizontal offsetdropShadowY
- Shadow vertical offsetdropShadowBlur
- Shadow blur radiusdropShadowColor
- Shadow coloropacity
- Element opacity (0 to 1)filter
- CSS filter effects
Image Elements
Layout
objectFit
- Object fit ("contain", "cover", "fill")objectPosition
- Object position (e.g., "center center", "top left")
Border
borderRadius
- Border radius (e.g., "10px", "50%")borderWidth
- Border width (e.g., "2px")borderColor
- Border color
Shadow
boxShadowX
- Box shadow horizontal offsetboxShadowY
- Box shadow vertical offsetboxShadowBlur
- Box shadow blur radiusboxShadowColor
- Box shadow color
Effects
opacity
- Image opacity (0 to 1)filter
- CSS filter effectsdropShadowX
,dropShadowY
,dropShadowBlur
,dropShadowColor
- Drop shadow
Shape Elements
Colors
fill
- Fill color (supports gradients)stroke
- Stroke colorstrokeWidth
- Stroke width
Border & Effects
borderRadius
- Corner radius (for rectangles/circles)opacity
- Shape opacity (0 to 1)dropShadowX
,dropShadowY
,dropShadowBlur
,dropShadowColor
- Drop shadow
Property Name Variations
Style parameters are case-insensitive and support common aliases:
Testing in Playground
You can test custom style parameters directly in the Studio Playground:
- Navigate to the Playground tab in your template
- Scroll to Style Parameters section
- Click Add to create a new style parameter
- Select the Parameter ID from the dropdown (with visual hints)
- Select the Property to override (filtered by element type)
- Enter a valid CSS Value
- Click Generate Image to see the result
Using with Dynamic URLs
Custom style parameters work seamlessly with Dynamic URLs:
Note: URL-encode special characters (e.g., #
becomes %23
)
Using with API
Include style parameters in your API requests:
Google Fonts Support
Custom style parameters automatically load Google Fonts when specified:
The system will:
- Detect Google Font names
- Automatically load the font from Google Fonts
- Apply it to the element during rendering
Practical Examples
Dynamic Theming
Personalized Styles
Gradient Effects
Responsive Typography
Important Notes
Property Validation
- Only valid CSS values are applied
- Invalid values are ignored (element uses default styles)
- Case-insensitive property names
- Aliases supported for common properties
Parameter ID Requirements
- Must match an existing parameterized element
- Cannot contain
.
(dot) or@
symbols in the parameter ID itself - Use the exact ID shown in the playground dropdown
Priority Order
Style parameters have the highest priority:
- Custom style parameters (highest)
- Regular parameter values
- Template default styles (lowest)
Performance
- Style parameters are processed during render time
- Google Fonts are cached and loaded efficiently
- No performance impact on templates without style parameters
Best Practices
Use Consistent Units: Stick to px
, rem
, or %
for sizes
Test in Playground: Verify styles before production use
Document Your Styles: Keep a reference of available style parameters for your templates
Use Aliases: Leverage case-insensitive aliases for easier integration
Combine with Regular Parameters: Use both content and style parameters for maximum flexibility
Validate Input: In your application, validate CSS values before sending to API
Consider Fallbacks: Design templates with sensible defaults in case style parameters are invalid
Troubleshooting
Style Not Applied
- ✅ Check parameter ID matches exactly (case-sensitive for IDs)
- ✅ Verify property name is supported for that element type
- ✅ Ensure CSS value is valid (e.g.,
"24px"
not"24"
) - ✅ Test in playground first to isolate issues
Font Not Loading
- ✅ Verify font name is correct (Google Fonts only)
- ✅ Check spelling and capitalization
- ✅ Ensure font supports your required weights
- ✅ Test with common fonts first (e.g., "Roboto", "Open Sans")
Multi-Page Issues
- ✅ Use correct page prefix (e.g.,
page1@
,page2@
) - ✅ Verify parameter exists on that specific page
- ✅ Check page number is correct (1-based indexing)