themeList.directive.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. angular.module('kityminderEditor')
  2. .directive('themeList', function() {
  3. return {
  4. restrict: 'E',
  5. templateUrl: 'ui/directive/themeList/themeList.html',
  6. replace: true,
  7. link: function($scope) {
  8. var themeList = kityminder.Minder.getThemeList();
  9. //$scope.themeList = themeList;
  10. $scope.getThemeThumbStyle = function (theme) {
  11. var themeObj = themeList[theme];
  12. if (!themeObj) {
  13. return;
  14. }
  15. var style = {
  16. 'color': themeObj['root-color'],
  17. 'border-radius': themeObj['root-radius'] / 2
  18. };
  19. if (themeObj['root-background']) {
  20. style['background'] = themeObj['root-background'].toString();
  21. }
  22. return style;
  23. };
  24. // 维护 theme key 列表以保证列表美观(不按字母顺序排序)
  25. $scope.themeKeyList = [
  26. 'classic',
  27. 'classic-compact',
  28. 'fresh-blue',
  29. 'fresh-blue-compat',
  30. 'fresh-green',
  31. 'fresh-green-compat',
  32. 'fresh-pink',
  33. 'fresh-pink-compat',
  34. 'fresh-purple',
  35. 'fresh-purple-compat',
  36. 'fresh-red',
  37. 'fresh-red-compat',
  38. 'fresh-soil',
  39. 'fresh-soil-compat',
  40. 'snow',
  41. 'snow-compact',
  42. 'tianpan',
  43. 'tianpan-compact',
  44. 'fish',
  45. 'wire'
  46. ];
  47. }
  48. }
  49. });