Package horizons :: Package gui :: Module style
[hide private]
[frames] | no frames]

Source Code for Module horizons.gui.style

  1  # ################################################### 
  2  # Copyright (C) 2008-2017 The Unknown Horizons Team 
  3  # team@unknown-horizons.org 
  4  # This file is part of Unknown Horizons. 
  5  # 
  6  # Unknown Horizons is free software; you can redistribute it and/or modify 
  7  # it under the terms of the GNU General Public License as published by 
  8  # the Free Software Foundation; either version 2 of the License, or 
  9  # (at your option) any later version. 
 10  # 
 11  # This program is distributed in the hope that it will be useful, 
 12  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 14  # GNU General Public License for more details. 
 15  # 
 16  # You should have received a copy of the GNU General Public License 
 17  # along with this program; if not, write to the 
 18  # Free Software Foundation, Inc., 
 19  # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
 20  # ################################################### 
 21   
 22  from fife.fifechan import Color 
 23   
 24  BROWN = {64: Color(80, 80, 40, 64), 
 25           96: Color(80, 80, 40, 96), 
 26           128: Color(80, 80, 40, 128), 
 27           192: Color(80, 80, 40, 192), 
 28           255: Color(80, 80, 40, 255), 
 29  } 
 30   
 31  WHITE = {32: Color(255, 255, 255, 32), 
 32           64: Color(255, 255, 255, 64), 
 33           96: Color(255, 255, 255, 96), 
 34           160: Color(255, 255, 255, 160), 
 35           255: Color(255, 255, 255, 255), 
 36  } 
 37   
 38  NOTHING = Color(0, 0, 0, 0) 
 39   
 40  STYLES = { 
 41  'default': { 
 42                  'default': { 
 43                          'background_color': NOTHING, 
 44                          'base_color': NOTHING, 
 45                          'foreground_color': BROWN[255], 
 46                          'selection_color': BROWN[192], 
 47                          'border_size': 0, 
 48                          'margins': (0, 0), 
 49                          'font': 'default', 
 50                          'vertical_scrollbar': 1, 
 51                          'horizontal_scrollbar': 0, 
 52                  }, 
 53                  'Button': { 
 54                          'base_color': BROWN[64], 
 55                          'foreground_color': BROWN[192], 
 56                          'margins': (10, 5), 
 57                  }, 
 58                  #TODO combine the following two after the tuple notation bug is fixed: 
 59                  # http://github.com/fifengine/fifengine/issues/656 
 60                  'CheckBox': { 
 61                          'background_color': WHITE[96], 
 62                  }, 
 63                  'RadioButton': { 
 64                          'background_color': WHITE[96], 
 65                  }, 
 66                  'ListBox': { 
 67                          'selection_color': WHITE[160], 
 68                  }, 
 69                  'ScrollArea': { 
 70                          'selection_color': WHITE[255], 
 71                          'background_color': WHITE[64], 
 72                          'base_color': BROWN[64], 
 73                  }, 
 74                  #TODO combine the following two after the tuple notation bug is fixed 
 75                  'Slider': { 
 76                          'base_color': BROWN[96], 
 77                  }, 
 78                  'StepSlider': { 
 79                          'base_color': BROWN[96], 
 80                  }, 
 81                  'TextField': { 
 82                          'selection_color': BROWN[96], 
 83                          'background_color': WHITE[64], 
 84                  }, 
 85  }, 
 86   
 87  'menu': { #Used in the main menu 
 88                  'default': { 
 89                          'font': 'headline_light', 
 90                  }, 
 91                  'Label': { 
 92                          'background_color': Color(0, 0, 0, 102), 
 93                          'font': 'mainmenu', 
 94                  }, 
 95  }, 
 96   
 97  'resource_bar': { 
 98                  'default': { 
 99                          'font': 'resourcebar', 
100                  }, 
101  }, 
102   
103  'headline': { # style for headlines 
104                  'default': { 
105                          'font': 'headline', 
106                  }, 
107  }, 
108   
109  'transparent': { # style for transparent widgets 
110                  'default': { 
111                          'background_color': Color(0, 0, 0, 0), 
112                  }, 
113                  'ScrollArea': { 
114                          'background_color': Color(0, 0, 0, 0), 
115                  }, 
116  }, 
117  } 
118