Guest User

Untitled

a guest
Jul 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. $my-colors: (
  2. 'default-blue': #0071ce,
  3. 'blue': #064f8e,
  4. 'yellow': #f79428,
  5. 'light-blue': #1888c8,
  6. 'green': #54a546,
  7. 'red': #C82022,
  8. 'pink': #b51e6d,
  9. 'orange': #e54e26
  10. );
  11.  
  12. $my-opacity: (
  13. 'dark': 1,
  14. 'light': 0.8
  15. );
  16.  
  17. @function get-color($key: 'default-blue') {
  18. @return map-get($my-colors, $key);
  19. }
  20.  
  21. @function get-color-alpha($name: 'default-blue', $opacity: 'dark') {
  22. $color: get-color($name);
  23. // Get the named opacity level, if it exists
  24. @if map-key-exists($my-opacity, $opacity) {
  25. $opacity: map-get($my-opacity, $opacity);
  26. }
  27.  
  28. // Use rgba() to manipulate the color's alpha level
  29. @return rgba($color, $opacity);
  30. }
  31.  
  32. li h3 {
  33. color: get-color-alpha('default-blue', 'light');
  34. }
Add Comment
Please, Sign In to add comment