Changeset 61645 for trunk/src/wp-admin/css/colors/_mixins.scss
- Timestamp:
- 02/15/2026 08:09:39 AM (3 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/css/colors/_mixins.scss (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/colors/_mixins.scss
r59656 r61645 1 1 @use 'sass:color'; 2 @use 'tokens'; 2 3 3 4 /* 4 * Button mixin - creates a button effect with correct5 * highlights/shadows, based on a base color.5 * Button mixin - creates a primary button effect. 6 * Uses CSS custom properties for theme color support across color schemes. 6 7 */ 7 @mixin button( $button-color, $button-text-color: #fff ) { 8 background: $button-color; 9 border-color: $button-color; 8 @mixin button( $button-text-color: #fff ) { 9 background: var(--wp-admin-theme-color); 10 border-color: transparent; 11 border-radius: tokens.$radius-s; 10 12 color: $button-text-color; 11 13 12 &:hover, 13 &:focus { 14 background: color.adjust($button-color, $lightness: 3%); 15 border-color: color.adjust($button-color, $lightness: -3%); 14 &:hover { 15 background: var(--wp-admin-theme-color-darker-10); 16 border-color: transparent; 16 17 color: $button-text-color; 17 18 } 18 19 19 20 &:focus { 21 background: var(--wp-admin-theme-color); 22 border-color: transparent; 23 color: $button-text-color; 24 /* Gutenberg-style focus ring: outer theme color + inset white for contrast */ 20 25 box-shadow: 21 0 0 0 1px #fff, 22 0 0 0 3px $button-color; 26 0 0 0 var(--wp-admin-border-width-focus, 1.5px) var(--wp-admin-theme-color), 27 inset 0 0 0 1px tokens.$white; 28 /* Visible in Windows High Contrast mode */ 29 outline: 1px solid transparent; 23 30 } 24 31 25 32 &:active { 26 background: color.adjust($button-color, $lightness: -5%);27 border-color: color.adjust($button-color, $lightness: -5%);33 background: var(--wp-admin-theme-color-darker-20); 34 border-color: transparent; 28 35 color: $button-text-color; 36 } 37 38 &:disabled, 39 &.disabled { 40 background: tokens.$gray-100; 41 border-color: transparent; 42 color: tokens.$gray-600; 43 cursor: not-allowed; 29 44 } 30 45 … … 32 47 &.active:focus, 33 48 &.active:hover { 34 background: $button-color;49 background: var(--wp-admin-theme-color-darker-10); 35 50 color: $button-text-color; 36 border-color: color.adjust($button-color, $lightness: -15%);37 box-shadow: inset 0 2px 5px -3px color.adjust($button-color, $lightness: -50%);51 border-color: transparent; 52 box-shadow: none; 38 53 } 39 54 } 55 56 /* 57 * Secondary button mixin - outlined style with theme color. 58 * Matches Gutenberg's .is-secondary button variant. 59 */ 60 @mixin button-secondary() { 61 background: transparent; 62 border: 1px solid var(--wp-admin-theme-color); 63 border-radius: tokens.$radius-s; 64 color: var(--wp-admin-theme-color); 65 66 &:hover { 67 background: rgba(var(--wp-admin-theme-color--rgb), 0.04); 68 border-color: var(--wp-admin-theme-color-darker-20); 69 color: var(--wp-admin-theme-color-darker-20); 70 } 71 72 &:focus { 73 background: transparent; 74 border-color: var(--wp-admin-theme-color); 75 color: var(--wp-admin-theme-color); 76 box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 1.5px) var(--wp-admin-theme-color); 77 outline: 1px solid transparent; 78 } 79 80 &:active { 81 background: rgba(var(--wp-admin-theme-color--rgb), 0.08); 82 border-color: var(--wp-admin-theme-color-darker-20); 83 color: var(--wp-admin-theme-color-darker-20); 84 box-shadow: none; 85 } 86 87 &:disabled, 88 &.disabled { 89 background: transparent; 90 border-color: tokens.$gray-300; 91 color: tokens.$gray-600; 92 cursor: not-allowed; 93 } 94 } 95 96 /* 97 * Tertiary button mixin - transparent background, gray text. 98 */ 99 @mixin button-tertiary() { 100 background: transparent; 101 border: 1px solid tokens.$gray-600; 102 border-radius: tokens.$radius-s; 103 color: tokens.$gray-900; 104 105 &:hover { 106 background: rgba(0, 0, 0, 0.05); 107 border-color: tokens.$gray-700; 108 color: tokens.$gray-900; 109 } 110 111 &:focus { 112 background: transparent; 113 border-color: var(--wp-admin-theme-color); 114 color: tokens.$gray-900; 115 box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 1.5px) var(--wp-admin-theme-color); 116 outline: 1px solid transparent; 117 } 118 119 &:active { 120 background: rgba(0, 0, 0, 0.1); 121 border-color: tokens.$gray-700; 122 color: tokens.$gray-900; 123 } 124 125 &:disabled, 126 &.disabled { 127 background: transparent; 128 border-color: tokens.$gray-400; 129 color: tokens.$gray-600; 130 cursor: not-allowed; 131 } 132 }
Note: See TracChangeset
for help on using the changeset viewer.