unset.go

  1package lipgloss
  2
  3// unset unsets a property from a style.
  4func (s *Style) unset(key propKey) {
  5	s.props = s.props.unset(key)
  6}
  7
  8// UnsetBold removes the bold style rule, if set.
  9func (s Style) UnsetBold() Style {
 10	s.unset(boldKey)
 11	return s
 12}
 13
 14// UnsetItalic removes the italic style rule, if set.
 15func (s Style) UnsetItalic() Style {
 16	s.unset(italicKey)
 17	return s
 18}
 19
 20// UnsetUnderline removes the underline style rule, if set.
 21func (s Style) UnsetUnderline() Style {
 22	s.unset(underlineKey)
 23	return s
 24}
 25
 26// UnsetStrikethrough removes the strikethrough style rule, if set.
 27func (s Style) UnsetStrikethrough() Style {
 28	s.unset(strikethroughKey)
 29	return s
 30}
 31
 32// UnsetReverse removes the reverse style rule, if set.
 33func (s Style) UnsetReverse() Style {
 34	s.unset(reverseKey)
 35	return s
 36}
 37
 38// UnsetBlink removes the blink style rule, if set.
 39func (s Style) UnsetBlink() Style {
 40	s.unset(blinkKey)
 41	return s
 42}
 43
 44// UnsetFaint removes the faint style rule, if set.
 45func (s Style) UnsetFaint() Style {
 46	s.unset(faintKey)
 47	return s
 48}
 49
 50// UnsetForeground removes the foreground style rule, if set.
 51func (s Style) UnsetForeground() Style {
 52	s.unset(foregroundKey)
 53	return s
 54}
 55
 56// UnsetBackground removes the background style rule, if set.
 57func (s Style) UnsetBackground() Style {
 58	s.unset(backgroundKey)
 59	return s
 60}
 61
 62// UnsetWidth removes the width style rule, if set.
 63func (s Style) UnsetWidth() Style {
 64	s.unset(widthKey)
 65	return s
 66}
 67
 68// UnsetHeight removes the height style rule, if set.
 69func (s Style) UnsetHeight() Style {
 70	s.unset(heightKey)
 71	return s
 72}
 73
 74// UnsetAlign removes the horizontal and vertical text alignment style rule, if set.
 75func (s Style) UnsetAlign() Style {
 76	s.unset(alignHorizontalKey)
 77	s.unset(alignVerticalKey)
 78	return s
 79}
 80
 81// UnsetAlignHorizontal removes the horizontal text alignment style rule, if set.
 82func (s Style) UnsetAlignHorizontal() Style {
 83	s.unset(alignHorizontalKey)
 84	return s
 85}
 86
 87// UnsetAlignVertical removes the vertical text alignment style rule, if set.
 88func (s Style) UnsetAlignVertical() Style {
 89	s.unset(alignVerticalKey)
 90	return s
 91}
 92
 93// UnsetPadding removes all padding style rules.
 94func (s Style) UnsetPadding() Style {
 95	s.unset(paddingLeftKey)
 96	s.unset(paddingRightKey)
 97	s.unset(paddingTopKey)
 98	s.unset(paddingBottomKey)
 99	return s
100}
101
102// UnsetPaddingLeft removes the left padding style rule, if set.
103func (s Style) UnsetPaddingLeft() Style {
104	s.unset(paddingLeftKey)
105	return s
106}
107
108// UnsetPaddingRight removes the right padding style rule, if set.
109func (s Style) UnsetPaddingRight() Style {
110	s.unset(paddingRightKey)
111	return s
112}
113
114// UnsetPaddingTop removes the top padding style rule, if set.
115func (s Style) UnsetPaddingTop() Style {
116	s.unset(paddingTopKey)
117	return s
118}
119
120// UnsetPaddingBottom removes the bottom padding style rule, if set.
121func (s Style) UnsetPaddingBottom() Style {
122	s.unset(paddingBottomKey)
123	return s
124}
125
126// UnsetColorWhitespace removes the rule for coloring padding, if set.
127func (s Style) UnsetColorWhitespace() Style {
128	s.unset(colorWhitespaceKey)
129	return s
130}
131
132// UnsetMargins removes all margin style rules.
133func (s Style) UnsetMargins() Style {
134	s.unset(marginLeftKey)
135	s.unset(marginRightKey)
136	s.unset(marginTopKey)
137	s.unset(marginBottomKey)
138	return s
139}
140
141// UnsetMarginLeft removes the left margin style rule, if set.
142func (s Style) UnsetMarginLeft() Style {
143	s.unset(marginLeftKey)
144	return s
145}
146
147// UnsetMarginRight removes the right margin style rule, if set.
148func (s Style) UnsetMarginRight() Style {
149	s.unset(marginRightKey)
150	return s
151}
152
153// UnsetMarginTop removes the top margin style rule, if set.
154func (s Style) UnsetMarginTop() Style {
155	s.unset(marginTopKey)
156	return s
157}
158
159// UnsetMarginBottom removes the bottom margin style rule, if set.
160func (s Style) UnsetMarginBottom() Style {
161	s.unset(marginBottomKey)
162	return s
163}
164
165// UnsetMarginBackground removes the margin's background color. Note that the
166// margin's background color can be set from the background color of another
167// style during inheritance.
168func (s Style) UnsetMarginBackground() Style {
169	s.unset(marginBackgroundKey)
170	return s
171}
172
173// UnsetBorderStyle removes the border style rule, if set.
174func (s Style) UnsetBorderStyle() Style {
175	s.unset(borderStyleKey)
176	return s
177}
178
179// UnsetBorderTop removes the border top style rule, if set.
180func (s Style) UnsetBorderTop() Style {
181	s.unset(borderTopKey)
182	return s
183}
184
185// UnsetBorderRight removes the border right style rule, if set.
186func (s Style) UnsetBorderRight() Style {
187	s.unset(borderRightKey)
188	return s
189}
190
191// UnsetBorderBottom removes the border bottom style rule, if set.
192func (s Style) UnsetBorderBottom() Style {
193	s.unset(borderBottomKey)
194	return s
195}
196
197// UnsetBorderLeft removes the border left style rule, if set.
198func (s Style) UnsetBorderLeft() Style {
199	s.unset(borderLeftKey)
200	return s
201}
202
203// UnsetBorderForeground removes all border foreground color styles, if set.
204func (s Style) UnsetBorderForeground() Style {
205	s.unset(borderTopForegroundKey)
206	s.unset(borderRightForegroundKey)
207	s.unset(borderBottomForegroundKey)
208	s.unset(borderLeftForegroundKey)
209	return s
210}
211
212// UnsetBorderTopForeground removes the top border foreground color rule,
213// if set.
214func (s Style) UnsetBorderTopForeground() Style {
215	s.unset(borderTopForegroundKey)
216	return s
217}
218
219// UnsetBorderRightForeground removes the right border foreground color rule,
220// if set.
221func (s Style) UnsetBorderRightForeground() Style {
222	s.unset(borderRightForegroundKey)
223	return s
224}
225
226// UnsetBorderBottomForeground removes the bottom border foreground color
227// rule, if set.
228func (s Style) UnsetBorderBottomForeground() Style {
229	s.unset(borderBottomForegroundKey)
230	return s
231}
232
233// UnsetBorderLeftForeground removes the left border foreground color rule,
234// if set.
235func (s Style) UnsetBorderLeftForeground() Style {
236	s.unset(borderLeftForegroundKey)
237	return s
238}
239
240// UnsetBorderBackground removes all border background color styles, if
241// set.
242func (s Style) UnsetBorderBackground() Style {
243	s.unset(borderTopBackgroundKey)
244	s.unset(borderRightBackgroundKey)
245	s.unset(borderBottomBackgroundKey)
246	s.unset(borderLeftBackgroundKey)
247	return s
248}
249
250// UnsetBorderTopBackgroundColor removes the top border background color rule,
251// if set.
252//
253// Deprecated: This function simply calls Style.UnsetBorderTopBackground.
254func (s Style) UnsetBorderTopBackgroundColor() Style {
255	return s.UnsetBorderTopBackground()
256}
257
258// UnsetBorderTopBackground removes the top border background color rule,
259// if set.
260func (s Style) UnsetBorderTopBackground() Style {
261	s.unset(borderTopBackgroundKey)
262	return s
263}
264
265// UnsetBorderRightBackground removes the right border background color
266// rule, if set.
267func (s Style) UnsetBorderRightBackground() Style {
268	s.unset(borderRightBackgroundKey)
269	return s
270}
271
272// UnsetBorderBottomBackground removes the bottom border background color
273// rule, if set.
274func (s Style) UnsetBorderBottomBackground() Style {
275	s.unset(borderBottomBackgroundKey)
276	return s
277}
278
279// UnsetBorderLeftBackground removes the left border color rule, if set.
280func (s Style) UnsetBorderLeftBackground() Style {
281	s.unset(borderLeftBackgroundKey)
282	return s
283}
284
285// UnsetInline removes the inline style rule, if set.
286func (s Style) UnsetInline() Style {
287	s.unset(inlineKey)
288	return s
289}
290
291// UnsetMaxWidth removes the max width style rule, if set.
292func (s Style) UnsetMaxWidth() Style {
293	s.unset(maxWidthKey)
294	return s
295}
296
297// UnsetMaxHeight removes the max height style rule, if set.
298func (s Style) UnsetMaxHeight() Style {
299	s.unset(maxHeightKey)
300	return s
301}
302
303// UnsetTabWidth removes the tab width style rule, if set.
304func (s Style) UnsetTabWidth() Style {
305	s.unset(tabWidthKey)
306	return s
307}
308
309// UnsetUnderlineSpaces removes the value set by UnderlineSpaces.
310func (s Style) UnsetUnderlineSpaces() Style {
311	s.unset(underlineSpacesKey)
312	return s
313}
314
315// UnsetStrikethroughSpaces removes the value set by StrikethroughSpaces.
316func (s Style) UnsetStrikethroughSpaces() Style {
317	s.unset(strikethroughSpacesKey)
318	return s
319}
320
321// UnsetTransform removes the value set by Transform.
322func (s Style) UnsetTransform() Style {
323	s.unset(transformKey)
324	return s
325}
326
327// UnsetString sets the underlying string value to the empty string.
328func (s Style) UnsetString() Style {
329	s.value = ""
330	return s
331}