ColorScheme.pm 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. package Slic3r::GUI::ColorScheme;
  2. use strict;
  3. use warnings;
  4. use POSIX;
  5. use vars qw(@ISA @EXPORT);
  6. use Exporter 'import';
  7. our @ISA = 'Exporter';
  8. our @EXPORT = qw($DEFAULT_COLORSCHEME $SOLID_BACKGROUNDCOLOR @SELECTED_COLOR @HOVER_COLOR @TOP_COLOR @BOTTOM_COLOR @GRID_COLOR @GROUND_COLOR @COLOR_CUTPLANE @COLOR_PARTS @COLOR_INFILL @COLOR_SUPPORT @COLOR_UNKNOWN @BED_COLOR @BED_GRID @BED_SELECTED @BED_OBJECTS @BED_INSTANCE @BED_DRAGGED @BED_CENTER @BED_SKIRT @BED_CLEARANCE @BED_DARK @BACKGROUND255 @TOOL_DARK @TOOL_SUPPORT @TOOL_STEPPERIM @TOOL_INFILL @TOOL_SHADE @TOOL_COLOR @BACKGROUND_COLOR @SPLINE_L_PEN @SPLINE_O_PEN @SPLINE_I_PEN @SPLINE_R_PEN );
  9. # DEFAULT values
  10. our $DEFAULT_COLORSCHEME = 1;
  11. our $SOLID_BACKGROUNDCOLOR = 0;
  12. our @SELECTED_COLOR = (0, 1, 0);
  13. our @HOVER_COLOR = (0.4, 0.9, 0); # Hover over Model
  14. our @TOP_COLOR = (10/255,98/255,144/255); # TOP Backgroud color
  15. our @BOTTOM_COLOR = (0,0,0); # BOTTOM Backgroud color
  16. our @BACKGROUND_COLOR = @TOP_COLOR; # SOLID background color
  17. our @GRID_COLOR = (0.2, 0.2, 0.2, 0.4); # Grid color
  18. our @GROUND_COLOR = (0.8, 0.6, 0.5, 0.4); # Ground or Plate color
  19. our @COLOR_CUTPLANE = (.8, .8, .8, 0.5);
  20. our @COLOR_PARTS = (1, 0.95, 0.2, 1); # Perimeter color
  21. our @COLOR_INFILL = (1, 0.45, 0.45, 1);
  22. our @COLOR_SUPPORT = (0.5, 1, 0.5, 1);
  23. our @COLOR_UNKNOWN = (0.5, 0.5, 1, 1);
  24. our @BED_COLOR = (255, 255, 255);
  25. our @BED_GRID = (230, 230, 230);
  26. our @BED_SELECTED = (255, 166, 128);
  27. our @BED_OBJECTS = (210, 210, 210);
  28. our @BED_INSTANCE = (255, 128, 128);
  29. our @BED_DRAGGED = (128, 128, 255);
  30. our @BED_CENTER = (200, 200, 200);
  31. our @BED_SKIRT = (150, 150, 150);
  32. our @BED_CLEARANCE = (0, 0, 200);
  33. our @BACKGROUND255 = (255, 255, 255);
  34. our @TOOL_DARK = (0, 0, 0);
  35. our @TOOL_SUPPORT = (0, 0, 0);
  36. our @TOOL_INFILL = (0, 0, 0.7);
  37. our @TOOL_STEPPERIM = (0.7, 0, 0);
  38. our @TOOL_SHADE = (0.95, 0.95, 0.95);
  39. our @TOOL_COLOR = (0.9, 0.9, 0.9);
  40. our @SPLINE_L_PEN = (50, 50, 50);
  41. our @SPLINE_O_PEN = (200, 200, 200);
  42. our @SPLINE_I_PEN = (255, 0, 0);
  43. our @SPLINE_R_PEN = (5, 120, 160);
  44. our @BED_DARK = (0, 0, 0);
  45. # S O L A R I Z E
  46. # # http://ethanschoonover.com/solarized
  47. our @COLOR_BASE03 = (0.00000,0.16863,0.21176);
  48. our @COLOR_BASE02 = (0.02745,0.21176,0.25882);
  49. our @COLOR_BASE01 = (0.34510,0.43137,0.45882);
  50. our @COLOR_BASE00 = (0.39608,0.48235,0.51373);
  51. our @COLOR_BASE0 = (0.51373,0.58039,0.58824);
  52. our @COLOR_BASE1 = (0.57647,0.63137,0.63137);
  53. our @COLOR_BASE2 = (0.93333,0.90980,0.83529);
  54. our @COLOR_BASE3 = (0.99216,0.96471,0.89020);
  55. our @COLOR_YELLOW = (0.70980,0.53725,0.00000);
  56. our @COLOR_ORANGE = (0.79608,0.29412,0.08627);
  57. our @COLOR_RED = (0.86275,0.19608,0.18431);
  58. our @COLOR_MAGENTA = (0.82745,0.21176,0.50980);
  59. our @COLOR_VIOLET = (0.42353,0.44314,0.76863);
  60. our @COLOR_BLUE = (0.14902,0.54510,0.82353);
  61. our @COLOR_CYAN = (0.16471,0.63137,0.59608);
  62. our @COLOR_GREEN = (0.52157,0.60000,0.00000);
  63. # create your own theme:
  64. # 1. add new sub and name it according to your scheme
  65. # 2. add that name to Preferences.pm
  66. # 3. Choose your newly created theme in Slic3rs' Preferences (File -> Preferences).
  67. sub getSolarized { # add this name to Preferences.pm
  68. $DEFAULT_COLORSCHEME = 0; # DISABLE default color scheme
  69. $SOLID_BACKGROUNDCOLOR = 1; # Switch between SOLID or FADED background color
  70. @SELECTED_COLOR = @COLOR_MAGENTA; # Color of selected Model
  71. @HOVER_COLOR = @COLOR_VIOLET; # Color when hovering over Model
  72. # @TOP_COLOR = @COLOR_BASE2; # FADE Background color - only used if $SOLID_BACKGROUNDCOLOR = 0
  73. # @BOTTOM_COLOR = @COLOR_BASE02; # FADE Background color - only used if $SOLID_BACKGROUNDCOLOR = 0
  74. @BACKGROUND_COLOR = @COLOR_BASE3; # SOLID Background color - REQUIRED for NOT getDefault
  75. @GRID_COLOR = (@COLOR_BASE1, 0.4); # Grid
  76. @GROUND_COLOR = (@COLOR_BASE2, 0.4); # Ground or Plate
  77. @COLOR_CUTPLANE = (@COLOR_BASE1, 0.5); # Cut plane
  78. @COLOR_PARTS = (@TOOL_COLOR, 1); # Perimeter
  79. @COLOR_INFILL = (@COLOR_BASE2, 1); # Infill
  80. @COLOR_SUPPORT = (@TOOL_SUPPORT, 1); # Support
  81. @COLOR_UNKNOWN = (@COLOR_CYAN, 1); # I don't know what that color's for!
  82. # 2DBed.pm and ./plater/2D.pm colors
  83. @BED_COLOR = map { ceil($_ * 255) } @COLOR_BASE2; # do math -> multiply each value by 255 and round up
  84. @BED_GRID = map { ceil($_ * 255) } @COLOR_BASE1; # Bed, Ground or Plate
  85. @BED_SELECTED = map { ceil($_ * 255) } @COLOR_YELLOW; # Selected Model
  86. @BED_INSTANCE = map { ceil($_ * 255) } @SELECTED_COLOR; # Real selected Model
  87. @BED_OBJECTS = map { ceil($_ * 255) } @COLOR_PARTS; # Models on bed
  88. @BED_DRAGGED = map { ceil($_ * 255) } @COLOR_CYAN; # Color while dragging
  89. @BED_CENTER = map { ceil($_ * 255) } @COLOR_BASE1; # Cross hair
  90. @BED_SKIRT = map { ceil($_ * 255) } @COLOR_BASE01; # Brim/Skirt
  91. @BED_CLEARANCE = map { ceil($_ * 255) } @COLOR_BLUE; # not sure what that does
  92. @BED_DARK = map { ceil($_ * 255) } @COLOR_BASE01; # not sure what that does
  93. @BACKGROUND255 = map { ceil($_ * 255) } @BACKGROUND_COLOR; # Backgroud color, this time RGB
  94. # 2DToolpaths.pm colors : LAYERS Tab
  95. @TOOL_DARK = @COLOR_BASE01; # Brim/Skirt
  96. @TOOL_SUPPORT = @COLOR_GREEN; # Support
  97. @TOOL_INFILL = @COLOR_BASE1; # Infill
  98. @TOOL_COLOR = @COLOR_BLUE; # Real Perimeter
  99. @TOOL_STEPPERIM = @COLOR_CYAN; # Inner Perimeter
  100. @TOOL_SHADE = @COLOR_BASE2; # Shade; model inside
  101. # Colors for *Layer heights...* dialog
  102. @SPLINE_L_PEN = map { ceil($_ * 255) } @COLOR_BASE01; # Line color
  103. @SPLINE_O_PEN = map { ceil($_ * 255) } @COLOR_BASE1; # Original color
  104. @SPLINE_I_PEN = map { ceil($_ * 255) } @COLOR_MAGENTA; # Interactive color
  105. @SPLINE_R_PEN = map { ceil($_ * 255) } @COLOR_VIOLET; # Resulting color
  106. }
  107. sub getDefault{
  108. $DEFAULT_COLORSCHEME = 1; # ENABLE default color scheme
  109. # Define your function here
  110. # getDefault is just a dummy function and uses the default values from above.
  111. }
  112. 1; # REQUIRED at EOF