icon.css 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. :host {
  2. display: inline-block;
  3. width: 1em;
  4. height: 1em;
  5. contain: strict;
  6. fill: currentColor;
  7. box-sizing: content-box !important;
  8. }
  9. :host .ionicon {
  10. stroke: currentColor;
  11. }
  12. .ionicon-fill-none {
  13. fill: none;
  14. }
  15. .ionicon-stroke-width {
  16. stroke-width: 32px;
  17. stroke-width: var(--ionicon-stroke-width, 32px);
  18. }
  19. .icon-inner,
  20. .ionicon,
  21. svg {
  22. display: block;
  23. height: 100%;
  24. width: 100%;
  25. }
  26. /* Icon RTL
  27. * -----------------------------------------------------------
  28. */
  29. /**
  30. * Safari <16.4 incorrectly reports
  31. * that it supports :dir(rtl) when it does not.
  32. * This @supports statement lets us target
  33. * WebKit browsers to apply the RTL fallback.
  34. * -webkit-named-image only exists on WebKit.
  35. * For WebKit browsers that do support :dir(rtl)
  36. * (i.e. Safari >= 16.4) then the :dir(rtl)
  37. * code farther down on the page will take
  38. * effect and override this fallback.
  39. */
  40. @supports (background: -webkit-named-image(i)) {
  41. :host(.icon-rtl) .icon-inner {
  42. transform: scaleX(-1);
  43. }
  44. }
  45. /**
  46. * Fallback for browsers that support
  47. * neither :host-context nor :dir.
  48. * The icon will not react to dir
  49. * changes, but it will at least
  50. * respect the dir on component load.
  51. */
  52. @supports not selector(:dir(rtl)) and selector(:host-context([dir='rtl'])) {
  53. :host(.icon-rtl) .icon-inner {
  54. transform: scaleX(-1);
  55. }
  56. }
  57. /* :host-context is supported in chromium; :dir is supported in safari & firefox */
  58. :host(.flip-rtl):host-context([dir='rtl']) .icon-inner {
  59. transform: scaleX(-1);
  60. }
  61. @supports selector(:dir(rtl)) {
  62. :host(.flip-rtl:dir(rtl)) .icon-inner {
  63. transform: scaleX(-1);
  64. }
  65. /**
  66. * This is needed for WebKit otherwise the fallback
  67. * will always cause the icon to be flipped if the document
  68. * loads in RTL.
  69. */
  70. :host(.flip-rtl:dir(ltr)) .icon-inner {
  71. transform: scaleX(1);
  72. }
  73. }
  74. /* Icon Sizes
  75. * -----------------------------------------------------------
  76. */
  77. :host(.icon-small) {
  78. font-size: 1.125rem !important;
  79. }
  80. :host(.icon-large) {
  81. font-size: 2rem !important;
  82. }
  83. /* Icon Colors
  84. * -----------------------------------------------------------
  85. */
  86. :host(.ion-color) {
  87. color: var(--ion-color-base) !important;
  88. }
  89. :host(.ion-color-primary) {
  90. --ion-color-base: var(--ion-color-primary, #3880ff);
  91. }
  92. :host(.ion-color-secondary) {
  93. --ion-color-base: var(--ion-color-secondary, #0cd1e8);
  94. }
  95. :host(.ion-color-tertiary) {
  96. --ion-color-base: var(--ion-color-tertiary, #f4a942);
  97. }
  98. :host(.ion-color-success) {
  99. --ion-color-base: var(--ion-color-success, #10dc60);
  100. }
  101. :host(.ion-color-warning) {
  102. --ion-color-base: var(--ion-color-warning, #ffce00);
  103. }
  104. :host(.ion-color-danger) {
  105. --ion-color-base: var(--ion-color-danger, #f14141);
  106. }
  107. :host(.ion-color-light) {
  108. --ion-color-base: var(--ion-color-light, #f4f5f8);
  109. }
  110. :host(.ion-color-medium) {
  111. --ion-color-base: var(--ion-color-medium, #989aa2);
  112. }
  113. :host(.ion-color-dark) {
  114. --ion-color-base: var(--ion-color-dark, #222428);
  115. }