Examples of code I've written in PHP, Javascript, SCSS, etc.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. @use "sass:map";
  2. @use "sass:color";
  3. $theme-colors: (
  4. "red-alert": #ce0018,
  5. "red-orangish": #de493b,
  6. "blue": #0736a4,
  7. "light-blue": #a4bfd9,
  8. "medium-blue": #1877f2,
  9. "dark-blue": #09c6f9,
  10. "orange": #ec9f05,
  11. "dark-orange": #ff4e00,
  12. "brand-orange": #f67602,
  13. "grey": #e6ebf1,
  14. "light-grey": #e9e9e9,
  15. "light2-grey": #bebebe,
  16. "light3-grey": rgb(245,245,245),
  17. "dark-grey": #212121,
  18. "faded-text": #425466,
  19. "faded-text2": #6c757d,
  20. "dark-green": #3bb78f,
  21. "light-green": #0bab64,
  22. "green": #63b521,
  23. "alt-blue-light": #e2f5ff,
  24. "alt-blue-medium": #2b96cc,
  25. "text-blue-medium": #425466,
  26. "alt-red-light": #f3beb8,
  27. "alt-red-medium": #f09898,
  28. );
  29. @function getColor($col) {
  30. @return map.get($theme-colors, $col);
  31. }
  32. @function darkenColor($col) {
  33. $oldCol : map.get($theme-colors, $col);
  34. $newCol : color.scale($oldCol, $lightness: -45%);
  35. @return $newCol;
  36. }
  37. @function lightenColor($col) {
  38. $oldCol : map.get($theme-colors, $col);
  39. $newCol : color.scale($oldCol, $lightness: 15%);
  40. @return $newCol;
  41. }
  42. @mixin button($col) {
  43. display: inline-block;
  44. //font-family: $btn-font-family;
  45. font-weight: 400;
  46. background-color: getColor($col);
  47. text-align: center;
  48. vertical-align: middle;
  49. user-select: none;
  50. border: none;
  51. padding: 7px 15px;
  52. border-radius: 5px;
  53. &:hover{
  54. background-color: darkenColor($col);
  55. }
  56. }
  57. // A linear gradient with the light color at the top left and dark color at
  58. // bottom right, that darkens on hover
  59. @mixin special-button($start, $end) {
  60. font-family: "PatuaOne";
  61. height: 2em;
  62. border: none;
  63. border-radius: 4px;
  64. padding: 3px;
  65. color: white;
  66. background-color: #045de9;
  67. background-image: linear-gradient(315deg, map.get($theme-colors, $start) 0%, map.get($theme-colors, $end) 74%);
  68. &:hover {
  69. background-image: linear-gradient(315deg, darkenColor($start) 0%, darkenColor($end) 74%);
  70. }
  71. }
  72. // A white button with a transparent background that becomes white and orange on hover
  73. @mixin transparent-button {
  74. text-align: center;
  75. font-size: 20px;
  76. border: 2px solid white;
  77. border-radius: 4px;
  78. padding: 10px;
  79. background-color: transparent;
  80. color: white;
  81. &:hover {
  82. background-color: white;
  83. color: map.get($theme-colors, "orange");
  84. }
  85. }
  86. @mixin inverting-button($primary, $background) {
  87. text-align: center;
  88. border: 2px solid $primary;
  89. border-radius: 4px;
  90. padding: 5px 10px;
  91. background-color: $background;
  92. color: $primary;
  93. &:hover {
  94. background-color: $primary;
  95. color: $background;
  96. }
  97. }
  98. // A button with a white background and specified accent color that reverses on hover
  99. @mixin brand-button($col) {
  100. width: 10em;
  101. height: 2.5em;;
  102. background-color: white;
  103. border: 2px solid map.get($theme-colors, $col);
  104. color: map.get($theme-colors, $col);
  105. border-radius: 4px;
  106. font-size: 16px;
  107. &:hover {
  108. background-color: map.get($theme-colors, $col);
  109. color: white;
  110. }
  111. }
  112. @mixin hovering {
  113. padding: 18px 9px;
  114. border-radius: 4px;
  115. background: white;
  116. box-shadow: 7px 10px 8px rgb(156 166 175 / 22%);
  117. transition: transform 0.2s;
  118. }
  119. @mixin hovering2 {
  120. padding: 18px 9px;
  121. border-radius: 4px;
  122. background: white;
  123. box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
  124. transition: transform 0.2s;
  125. }
  126. @mixin hovering3 {
  127. padding: 18px 9px;
  128. border-radius: 4px;
  129. background: white;
  130. box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;
  131. transition: transform 0.2s;
  132. }
  133. @mixin hovering-light {
  134. padding: 18px 9px;
  135. border-radius: 4px;
  136. background: white;
  137. box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
  138. transition: transform 0.2s;
  139. }