lipgloss/unset.go

324 lines
7.7 KiB
Go
Raw Normal View History

2021-03-05 04:48:09 +03:00
package lipgloss
// unset unsets a property from a style.
func (s *Style) unset(key propKey) {
s.props = s.props.unset(key)
}
2021-03-05 04:48:09 +03:00
// UnsetBold removes the bold style rule, if set.
func (s Style) UnsetBold() Style {
s.unset(boldKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetItalic removes the italic style rule, if set.
func (s Style) UnsetItalic() Style {
s.unset(italicKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetUnderline removes the underline style rule, if set.
2021-03-05 04:48:09 +03:00
func (s Style) UnsetUnderline() Style {
s.unset(underlineKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetStrikethrough removes the strikethrough style rule, if set.
func (s Style) UnsetStrikethrough() Style {
s.unset(strikethroughKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetReverse removes the reverse style rule, if set.
func (s Style) UnsetReverse() Style {
s.unset(reverseKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetBlink removes the blink style rule, if set.
2021-03-05 04:48:09 +03:00
func (s Style) UnsetBlink() Style {
s.unset(blinkKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetFaint removes the faint style rule, if set.
func (s Style) UnsetFaint() Style {
s.unset(faintKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetForeground removes the foreground style rule, if set.
2021-03-05 04:48:09 +03:00
func (s Style) UnsetForeground() Style {
s.unset(foregroundKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetBackground removes the background style rule, if set.
func (s Style) UnsetBackground() Style {
s.unset(backgroundKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetWidth removes the width style rule, if set.
func (s Style) UnsetWidth() Style {
s.unset(widthKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-03-24 21:42:45 +03:00
// UnsetHeight removes the height style rule, if set.
func (s Style) UnsetHeight() Style {
s.unset(heightKey)
2021-03-24 21:42:45 +03:00
return s
}
// UnsetAlign removes the horizontal and vertical text alignment style rule, if set.
2021-03-05 04:48:09 +03:00
func (s Style) UnsetAlign() Style {
s.unset(alignHorizontalKey)
s.unset(alignVerticalKey)
return s
}
// UnsetAlignHorizontal removes the horizontal text alignment style rule, if set.
func (s Style) UnsetAlignHorizontal() Style {
s.unset(alignHorizontalKey)
return s
}
2022-11-08 12:55:11 +03:00
// UnsetAlignVertical removes the vertical text alignment style rule, if set.
func (s Style) UnsetAlignVertical() Style {
s.unset(alignVerticalKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetPadding removes all padding style rules.
func (s Style) UnsetPadding() Style {
s.unset(paddingLeftKey)
s.unset(paddingRightKey)
s.unset(paddingTopKey)
s.unset(paddingBottomKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetPaddingLeft removes the left padding style rule, if set.
func (s Style) UnsetPaddingLeft() Style {
s.unset(paddingLeftKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetPaddingRight removes the right padding style rule, if set.
func (s Style) UnsetPaddingRight() Style {
s.unset(paddingRightKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetPaddingTop removes the top padding style rule, if set.
func (s Style) UnsetPaddingTop() Style {
s.unset(paddingTopKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetPaddingBottom removes the bottom padding style rule, if set.
func (s Style) UnsetPaddingBottom() Style {
s.unset(paddingBottomKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-03-05 20:23:25 +03:00
// UnsetColorWhitespace removes the rule for coloring padding, if set.
func (s Style) UnsetColorWhitespace() Style {
s.unset(colorWhitespaceKey)
2021-03-05 04:48:09 +03:00
return s
}
// UnsetMargins removes all margin style rules.
func (s Style) UnsetMargins() Style {
s.unset(marginLeftKey)
s.unset(marginRightKey)
s.unset(marginTopKey)
s.unset(marginBottomKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetMarginLeft removes the left margin style rule, if set.
func (s Style) UnsetMarginLeft() Style {
s.unset(marginLeftKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetMarginRight removes the right margin style rule, if set.
func (s Style) UnsetMarginRight() Style {
s.unset(marginRightKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetMarginTop removes the top margin style rule, if set.
func (s Style) UnsetMarginTop() Style {
s.unset(marginTopKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetMarginBottom removes the bottom margin style rule, if set.
func (s Style) UnsetMarginBottom() Style {
s.unset(marginBottomKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-07 19:12:55 +03:00
// UnsetMarginBackground removes the margin's background color. Note that the
// margin's background color can be set from the background color of another
// style during inheritance.
2021-03-31 01:08:06 +03:00
func (s Style) UnsetMarginBackground() Style {
s.unset(marginBackgroundKey)
2021-03-31 01:08:06 +03:00
return s
}
2021-03-26 03:43:40 +03:00
// UnsetBorderStyle removes the border style rule, if set.
func (s Style) UnsetBorderStyle() Style {
s.unset(borderStyleKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderTop removes the border top style rule, if set.
func (s Style) UnsetBorderTop() Style {
s.unset(borderTopKey)
2021-03-26 03:43:40 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetBorderRight removes the border right style rule, if set.
2021-03-26 03:43:40 +03:00
func (s Style) UnsetBorderRight() Style {
s.unset(borderRightKey)
2021-03-26 03:43:40 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetBorderBottom removes the border bottom style rule, if set.
2021-03-26 03:43:40 +03:00
func (s Style) UnsetBorderBottom() Style {
s.unset(borderBottomKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderLeft removes the border left style rule, if set.
func (s Style) UnsetBorderLeft() Style {
s.unset(borderLeftKey)
2021-03-26 03:43:40 +03:00
return s
}
2021-04-07 19:12:55 +03:00
// UnsetBorderForeground removes all border foreground color styles, if set.
func (s Style) UnsetBorderForeground() Style {
s.unset(borderTopForegroundKey)
s.unset(borderRightForegroundKey)
s.unset(borderBottomForegroundKey)
s.unset(borderLeftForegroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderTopForeground removes the top border foreground color rule,
2021-03-26 03:43:40 +03:00
// if set.
func (s Style) UnsetBorderTopForeground() Style {
s.unset(borderTopForegroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderRightForeground removes the right border foreground color rule,
2021-03-26 03:43:40 +03:00
// if set.
func (s Style) UnsetBorderRightForeground() Style {
s.unset(borderRightForegroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderBottomForeground removes the bottom border foreground color
2021-03-26 03:43:40 +03:00
// rule, if set.
func (s Style) UnsetBorderBottomForeground() Style {
s.unset(borderBottomForegroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderLeftForeground removes the left border foreground color rule,
2021-03-26 03:43:40 +03:00
// if set.
func (s Style) UnsetBorderLeftForeground() Style {
s.unset(borderLeftForegroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderBackground removes all border background color styles, if
2021-03-26 03:43:40 +03:00
// set.
func (s Style) UnsetBorderBackground() Style {
s.unset(borderTopBackgroundKey)
s.unset(borderRightBackgroundKey)
s.unset(borderBottomBackgroundKey)
s.unset(borderLeftBackgroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderTopBackgroundColor removes the top border background color rule,
2021-03-26 03:43:40 +03:00
// if set.
func (s Style) UnsetBorderTopBackgroundColor() Style {
s.unset(borderTopBackgroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderRightBackground removes the right border background color
2021-03-26 03:43:40 +03:00
// rule, if set.
func (s Style) UnsetBorderRightBackground() Style {
s.unset(borderRightBackgroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderBottomBackground removes the bottom border background color
2021-03-26 03:43:40 +03:00
// rule, if set.
func (s Style) UnsetBorderBottomBackground() Style {
s.unset(borderBottomBackgroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetBorderLeftBackground removes the left border color rule, if set.
func (s Style) UnsetBorderLeftBackground() Style {
s.unset(borderLeftBackgroundKey)
2021-03-26 03:43:40 +03:00
return s
}
// UnsetInline removes the inline style rule, if set.
func (s Style) UnsetInline() Style {
s.unset(inlineKey)
return s
}
2021-03-05 04:48:09 +03:00
// UnsetMaxWidth removes the max width style rule, if set.
func (s Style) UnsetMaxWidth() Style {
s.unset(maxWidthKey)
2021-03-05 04:48:09 +03:00
return s
}
2021-04-06 06:03:10 +03:00
// UnsetMaxHeight removes the max height style rule, if set.
2021-03-24 21:42:45 +03:00
func (s Style) UnsetMaxHeight() Style {
s.unset(maxHeightKey)
2021-03-24 21:42:45 +03:00
return s
}
// UnsetTabWidth removes the tab width style rule, if set.
func (s Style) UnsetTabWidth() Style {
s.unset(tabWidthKey)
return s
}
2021-03-10 18:21:21 +03:00
// UnsetUnderlineSpaces removes the value set by UnderlineSpaces.
func (s Style) UnsetUnderlineSpaces() Style {
s.unset(underlineSpacesKey)
return s
}
// UnsetStrikethroughSpaces removes the value set by StrikethroughSpaces.
func (s Style) UnsetStrikethroughSpaces() Style {
s.unset(strikethroughSpacesKey)
return s
}
// UnsetTransform removes the value set by Transform.
func (s Style) UnsetTransform() Style {
s.unset(transformKey)
return s
}
// UnsetString sets the underlying string value to the empty string.
func (s Style) UnsetString() Style {
s.value = ""
return s
}