ConditionalComponentTextStyle
extends ConditionalTextStyle
in package
Conditional text style for component text.
Alias for ConditionalTextStyle, used in component textStyle contexts.
Tags
Table of Contents
Methods
- addCondition() : $this
- Add a condition.
- compactSize() : self
- Create a smaller text style for compact screens.
- darkMode() : self
- Create a dark mode text style.
- hasConditions() : bool
- Check if any conditions have been set.
- jsonSerialize() : array<string, mixed>
- {@inheritdoc}
- lightMode() : self
- Create a light mode text style.
- setBackgroundColor() : $this
- Set the background color.
- setFontName() : $this
- Set the font name.
- setFontSize() : $this
- Set the font size.
- setFontStyle() : $this
- Set the font style.
- setFontWeight() : $this
- Set the font weight.
- setFontWidth() : $this
- Set the font width.
- setLineHeight() : $this
- Set the line height.
- setTextAlignment() : $this
- Set the text alignment.
- setTextColor() : $this
- Set the text color.
- setTextShadow() : $this
- Set the text shadow.
- setTracking() : $this
- Set the tracking (letter spacing).
Methods
addCondition()
Add a condition.
public
addCondition(Condition $condition) : $this
Parameters
- $condition : Condition
-
The condition to add.
Return values
$thiscompactSize()
Create a smaller text style for compact screens.
public
static compactSize(int $fontSize) : self
Parameters
- $fontSize : int
-
The smaller font size.
Return values
self —A new instance.
darkMode()
Create a dark mode text style.
public
static darkMode(string $textColor) : self
Parameters
- $textColor : string
-
The dark mode text color.
Return values
self —A new instance.
hasConditions()
Check if any conditions have been set.
public
hasConditions() : bool
Return values
bool —True if conditions exist.
jsonSerialize()
{@inheritdoc}
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>lightMode()
Create a light mode text style.
public
static lightMode(string $textColor) : self
Parameters
- $textColor : string
-
The light mode text color.
Return values
self —A new instance.
setBackgroundColor()
Set the background color.
public
setBackgroundColor(string $color) : $this
Parameters
- $color : string
-
The color in hex format.
Return values
$thissetFontName()
Set the font name.
public
setFontName(string $fontName) : $this
Parameters
- $fontName : string
-
The font name.
Return values
$thissetFontSize()
Set the font size.
public
setFontSize(int $size) : $this
Parameters
- $size : int
-
The size in points.
Return values
$thissetFontStyle()
Set the font style.
public
setFontStyle(string $style) : $this
Parameters
- $style : string
-
The style ('normal', 'italic', 'oblique').
Return values
$thissetFontWeight()
Set the font weight.
public
setFontWeight(int $weight) : $this
Parameters
- $weight : int
-
The weight (100-900).
Return values
$thissetFontWidth()
Set the font width.
public
setFontWidth(string $width) : $this
Parameters
- $width : string
-
The width value.
Return values
$thissetLineHeight()
Set the line height.
public
setLineHeight(float $height) : $this
Parameters
- $height : float
-
The line height in points.
Return values
$thissetTextAlignment()
Set the text alignment.
public
setTextAlignment(string $alignment) : $this
Parameters
- $alignment : string
-
One of 'left', 'center', 'right', 'justified'.
Return values
$thissetTextColor()
Set the text color.
public
setTextColor(string $color) : $this
Parameters
- $color : string
-
The color in hex format.
Return values
$thissetTextShadow()
Set the text shadow.
public
setTextShadow(array<string, mixed> $shadow) : $this
Parameters
- $shadow : array<string, mixed>
-
The shadow configuration.
Return values
$thissetTracking()
Set the tracking (letter spacing).
public
setTracking(float $tracking) : $this
Parameters
- $tracking : float
-
The tracking value.