ColorScheme.pm 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 @rotateX90cw @rotateX90ccw @rotateX180 @rotateY90cw @rotateY90ccw @rotateY180 @rotateZ90cw @rotateZ90ccw @rotateZ180 @rotate45cw @rotate45ccw @rotateX90cwT @rotateX90ccwT @rotateY90cwT @rotateY90ccwT @rotateZ90cwT @rotateZ90ccwT @rotateZ45cwT @rotateZ45ccwT @mirrorX @mirrorY @mirrorZ );
  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. # ICONS for the Context Menu
  46. our @rotateX90cw = "arrow_rotate_x_clockwise.png";
  47. our @rotateX90ccw = "arrow_rotate_x_anticlockwise.png";
  48. our @rotateX180 = "arrow_rotate_x_clockwise.png";
  49. our @rotateY90cw = "arrow_rotate_y_clockwise.png";
  50. our @rotateY90ccw = "arrow_rotate_y_anticlockwise.png";
  51. our @rotateY180 = "arrow_rotate_y_clockwise.png";
  52. our @rotateZ90cw = "arrow_rotate_z_clockwise.png";
  53. our @rotateZ90ccw = "arrow_rotate_z_anticlockwise.png";
  54. our @rotateZ180 = "arrow_rotate_z_clockwise.png";
  55. our @rotate45cw = "arrow_rotate_z_clockwise.png";
  56. our @rotate45ccw = "arrow_rotate_z_anticlockwise.png";
  57. our @mirrorX = 'shape_flip_horizontal_x.png';
  58. our @mirrorY = 'shape_flip_horizontal_y.png';
  59. our @mirrorZ = 'shape_flip_horizontal_z.png';
  60. # ICONS for the Toolbar (might be different)
  61. our @rotateX90cwT = "arrow_rotate_x_clockwise.png";
  62. our @rotateX90ccwT = "arrow_rotate_x_anticlockwise.png";
  63. our @rotateY90cwT = "arrow_rotate_y_clockwise.png";
  64. our @rotateY90ccwT = "arrow_rotate_y_anticlockwise.png";
  65. our @rotateZ90cwT = "arrow_rotate_z_clockwise.png";
  66. our @rotateZ90ccwT = "arrow_rotate_z_anticlockwise.png";
  67. our @rotateZ45cwT = "arrow_rotate_z_clockwise.png";
  68. our @rotateZ45ccwT = "arrow_rotate_z_anticlockwise.png";
  69. # S O L A R I Z E
  70. # # http://ethanschoonover.com/solarized
  71. our @COLOR_BASE03 = (0.00000,0.16863,0.21176);
  72. our @COLOR_BASE02 = (0.02745,0.21176,0.25882);
  73. our @COLOR_BASE01 = (0.34510,0.43137,0.45882);
  74. our @COLOR_BASE00 = (0.39608,0.48235,0.51373);
  75. our @COLOR_BASE0 = (0.51373,0.58039,0.58824);
  76. our @COLOR_BASE1 = (0.57647,0.63137,0.63137);
  77. our @COLOR_BASE2 = (0.93333,0.90980,0.83529);
  78. our @COLOR_BASE3 = (0.99216,0.96471,0.89020);
  79. our @COLOR_YELLOW = (0.70980,0.53725,0.00000);
  80. our @COLOR_ORANGE = (0.79608,0.29412,0.08627);
  81. our @COLOR_RED = (0.86275,0.19608,0.18431);
  82. our @COLOR_MAGENTA = (0.82745,0.21176,0.50980);
  83. our @COLOR_VIOLET = (0.42353,0.44314,0.76863);
  84. our @COLOR_BLUE = (0.14902,0.54510,0.82353);
  85. our @COLOR_CYAN = (0.16471,0.63137,0.59608);
  86. our @COLOR_GREEN = (0.52157,0.60000,0.00000);
  87. # create your own theme:
  88. # 1. add new sub and name it according to your scheme
  89. # 2. add that name to Preferences.pm
  90. # 3. Choose your newly created theme in Slic3rs' Preferences (File -> Preferences).
  91. sub getSolarized { # add this name to Preferences.pm
  92. $DEFAULT_COLORSCHEME = 0; # DISABLE default color scheme
  93. $SOLID_BACKGROUNDCOLOR = 1; # Switch between SOLID or FADED background color
  94. my $largeicons = 0; # Default: 0. 1 for large icons-set.
  95. if ($Slic3r::GUI::Settings->{_}{rotation_controls} eq 'xyz-big'){
  96. $largeicons = 1;
  97. }
  98. @SELECTED_COLOR = @COLOR_MAGENTA; # Color of selected Model
  99. @HOVER_COLOR = @COLOR_VIOLET; # Color when hovering over Model
  100. # @TOP_COLOR = @COLOR_BASE2; # FADE Background color - only used if $SOLID_BACKGROUNDCOLOR = 0
  101. # @BOTTOM_COLOR = @COLOR_BASE02; # FADE Background color - only used if $SOLID_BACKGROUNDCOLOR = 0
  102. @BACKGROUND_COLOR = @COLOR_BASE3; # SOLID Background color - REQUIRED for NOT getDefault
  103. @GRID_COLOR = (@COLOR_BASE1, 0.4); # Grid
  104. @GROUND_COLOR = (@COLOR_BASE2, 0.4); # Ground or Plate
  105. @COLOR_CUTPLANE = (@COLOR_BASE1, 0.5); # Cut plane
  106. @COLOR_PARTS = (@TOOL_COLOR, 1); # Perimeter
  107. @COLOR_INFILL = (@COLOR_BASE2, 1); # Infill
  108. @COLOR_SUPPORT = (@TOOL_SUPPORT, 1); # Support
  109. @COLOR_UNKNOWN = (@COLOR_CYAN, 1); # I don't know what that color's for!
  110. # 2DBed.pm and ./plater/2D.pm colors
  111. @BED_COLOR = map { ceil($_ * 255) } @COLOR_BASE2; # do math -> multiply each value by 255 and round up
  112. @BED_GRID = map { ceil($_ * 255) } @COLOR_BASE1; # Bed, Ground or Plate
  113. @BED_SELECTED = map { ceil($_ * 255) } @COLOR_YELLOW; # Selected Model
  114. @BED_INSTANCE = map { ceil($_ * 255) } @SELECTED_COLOR; # Real selected Model
  115. @BED_OBJECTS = map { ceil($_ * 255) } @COLOR_PARTS; # Models on bed
  116. @BED_DRAGGED = map { ceil($_ * 255) } @COLOR_CYAN; # Color while dragging
  117. @BED_CENTER = map { ceil($_ * 255) } @COLOR_BASE1; # Cross hair
  118. @BED_SKIRT = map { ceil($_ * 255) } @COLOR_BASE01; # Brim/Skirt
  119. @BED_CLEARANCE = map { ceil($_ * 255) } @COLOR_BLUE; # not sure what that does
  120. @BED_DARK = map { ceil($_ * 255) } @COLOR_BASE01; # not sure what that does
  121. @BACKGROUND255 = map { ceil($_ * 255) } @BACKGROUND_COLOR; # Backgroud color, this time RGB
  122. # 2DToolpaths.pm colors : LAYERS Tab
  123. @TOOL_DARK = @COLOR_BASE01; # Brim/Skirt
  124. @TOOL_SUPPORT = @COLOR_GREEN; # Support
  125. @TOOL_INFILL = @COLOR_BASE1; # Infill
  126. @TOOL_COLOR = @COLOR_BLUE; # Real Perimeter
  127. @TOOL_STEPPERIM = @COLOR_CYAN; # Inner Perimeter
  128. @TOOL_SHADE = @COLOR_BASE2; # Shade; model inside
  129. # Colors for *Layer heights...* dialog
  130. @SPLINE_L_PEN = map { ceil($_ * 255) } @COLOR_BASE01; # Line color
  131. @SPLINE_O_PEN = map { ceil($_ * 255) } @COLOR_BASE1; # Original color
  132. @SPLINE_I_PEN = map { ceil($_ * 255) } @COLOR_MAGENTA; # Interactive color
  133. @SPLINE_R_PEN = map { ceil($_ * 255) } @COLOR_VIOLET; # Resulting color
  134. if ($largeicons == 1){ # use large icons
  135. # ICONS for the Toolbar (might be different)
  136. our @rotateX90cwT = 'solarized/arrow_rotate_x_clockwise90.png';
  137. our @rotateX90ccwT = 'solarized/arrow_rotate_x_anticlockwise90.png';
  138. our @rotateY90cwT = 'solarized/arrow_rotate_y_clockwise90.png';
  139. our @rotateY90ccwT = 'solarized/arrow_rotate_y_anticlockwise90.png';
  140. our @rotateZ90cwT = 'solarized/arrow_rotate_z_clockwise90.png';
  141. our @rotateZ90ccwT = 'solarized/arrow_rotate_z_anticlockwise90.png';
  142. our @rotateZ45cwT = 'solarized/arrow_rotate_z_clockwise45.png';
  143. our @rotateZ45ccwT = 'solarized/arrow_rotate_z_anticlockwise45.png';
  144. } else {
  145. # use default or small icons
  146. our @rotateX90cwT = 'solarized/arrow_rotate_x_clockwise90_16.png';
  147. our @rotateX90ccwT = 'solarized/arrow_rotate_x_anticlockwise90_16.png';
  148. our @rotateY90cwT = 'solarized/arrow_rotate_y_clockwise90_16.png';
  149. our @rotateY90ccwT = 'solarized/arrow_rotate_y_anticlockwise90_16.png';
  150. our @rotateZ90cwT = 'solarized/arrow_rotate_z_clockwise90_16.png';
  151. our @rotateZ90ccwT = 'solarized/arrow_rotate_z_anticlockwise90_16.png';
  152. our @rotateZ45cwT = 'solarized/arrow_rotate_z_clockwise45_16.png';
  153. our @rotateZ45ccwT = 'solarized/arrow_rotate_z_anticlockwise45_16.png';
  154. }
  155. our @rotateX90cw = 'solarized/arrow_rotate_x_clockwise90_16.png';
  156. our @rotateX90ccw = 'solarized/arrow_rotate_x_anticlockwise90_16.png';
  157. our @rotateX180 = 'solarized/arrow_rotate_x_180_16.png';
  158. our @rotateY90cw = 'solarized/arrow_rotate_y_clockwise90_16.png';
  159. our @rotateY90ccw = 'solarized/arrow_rotate_y_anticlockwise90_16.png';
  160. our @rotateY180 = 'solarized/arrow_rotate_y_180_16.png';
  161. our @rotateZ90cw = 'solarized/arrow_rotate_z_clockwise90_16.png';
  162. our @rotateZ90ccw = 'solarized/arrow_rotate_z_anticlockwise90_16.png';
  163. our @rotateZ180 = 'solarized/arrow_rotate_z_180_16.png';
  164. our @rotate45cw = 'solarized/arrow_rotate_z_clockwise45_16.png';
  165. our @rotate45ccw = 'solarized/arrow_rotate_z_anticlockwise45_16.png';
  166. }
  167. sub getDefault{
  168. $DEFAULT_COLORSCHEME = 1; # ENABLE default color scheme
  169. # Define your function here
  170. # getDefault is just a dummy function and uses the default values from above.
  171. }
  172. 1; # REQUIRED at EOF