button.scss 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  2. // For licensing, see LICENSE.md or http://ckeditor.com/license
  3. /**
  4. * Implements a button of given background color.
  5. *
  6. * @param {String} $color - Background color of the button.
  7. */
  8. @mixin ck-button-colors( $color, $offset: 0 ) {
  9. background: ck-color( $color, $offset );
  10. border-color: ck-border-color( $color, $offset );
  11. @include ck-button-state-colors( $color, $offset );
  12. }
  13. /**
  14. * Implements button states.
  15. *
  16. * @param {String} $color - Background color of the button.
  17. */
  18. @mixin ck-button-state-colors( $color, $offset: 0 ) {
  19. &:not(.ck-disabled) {
  20. &:hover,
  21. &:focus {
  22. background: ck-color( $color, $offset - 10 );
  23. border-color: ck-border-color( $color, $offset - 10 );
  24. }
  25. &:active {
  26. background: ck-color( $color, $offset - 15 );
  27. border-color: ck-border-color( $color, $offset - 15 );
  28. box-shadow: inset 0 2px 2px ck-color( $color, $offset - 25 );
  29. }
  30. }
  31. // https://github.com/ckeditor/ckeditor5-theme-lark/issues/98
  32. &.ck-disabled {
  33. background: ck-color( $color, $offset + 10 );
  34. border-color: ck-border-color( $color, $offset + 10 );
  35. }
  36. }
  37. /**
  38. * A helper to define button–specific icon styles.
  39. *
  40. */
  41. @mixin ck-button-icon {
  42. .ck-icon {
  43. @content;
  44. }
  45. }
  46. .ck-button,
  47. a.ck-button {
  48. @include ck-button-colors( 'background' );
  49. @include ck-rounded-corners();
  50. border-width: 1px;
  51. border-style: solid;
  52. white-space: nowrap;
  53. cursor: default;
  54. vertical-align: middle;
  55. padding: ck-spacing( 'small' );
  56. line-height: $ck-icon-size / $ck-font-size-base;
  57. &:focus {
  58. @include ck-focus-ring();
  59. @include ck-box-shadow( $ck-focus-outer-shadow );
  60. }
  61. @include ck-button-icon {
  62. float: left;
  63. }
  64. // https://github.com/ckeditor/ckeditor5-theme-lark/issues/70
  65. &.ck-disabled {
  66. @include ck-button-icon {
  67. @include ck-disabled;
  68. }
  69. // https://github.com/ckeditor/ckeditor5-theme-lark/issues/98
  70. .ck-button__label {
  71. @include ck-disabled;
  72. }
  73. }
  74. &.ck-button_with-text {
  75. padding: ck-spacing( 'small' ) ck-spacing();
  76. @include ck-button-icon {
  77. margin-left: -#{ck-spacing( 'small' )};
  78. margin-right: ck-spacing( 'small' );
  79. }
  80. .ck-button__label {
  81. display: block;
  82. }
  83. }
  84. &.ck-on {
  85. @include ck-button-colors( 'foreground' );
  86. }
  87. &-action {
  88. @include ck-button-colors( 'action' );
  89. text-shadow: 0 -1px ck-color( 'action', -20 );
  90. color: ck-color();
  91. &:hover,
  92. &:focus,
  93. &:active {
  94. text-shadow: 0 -1px ck-color( 'action', -40 );
  95. }
  96. }
  97. &-bold {
  98. font-weight: bold;
  99. }
  100. .ck-icon {
  101. use,
  102. use * {
  103. color: inherit;
  104. }
  105. }
  106. .ck-button__label {
  107. float: left;
  108. line-height: inherit;
  109. font-size: inherit;
  110. font-weight: inherit;
  111. color: inherit;
  112. cursor: inherit;
  113. }
  114. }