unset.go 7.8 KB

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