Changeset 157


Ignore:
Timestamp:
03/03/2012 02:11:42 PM (3 years ago)
Author:
jelinson
Message:

updated colors

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/block.py

    r147 r157  
    3131        self.buildingsToBuild = []
    3232       
    33         # Hardcoded in for now.
    34         self.backgroundColors = [MAUVE,WHITE,GREEN,BLUE,RED,CYAN,FAKEBLACK,LIGHT_GREEN,YELLOW,GRAY,GRAYBLUE,MAGENTA]
    35         self.myColor = self.backgroundColors[ID]
    36        
    3733    def createBlockMap(self,scale):
    3834        """
     
    5046        landscape = WindowEntry(Response('windows',[],False,True))
    5147        landscape.addImage(Image((0,0),MAP_W * scale,MAP_H * scale,landscapeArt))
    52         landscape.addRectangle(Rectangle((0,0),MAP_W * scale,MAP_H * scale,self.myColor))
     48        landscape.addRectangle(Rectangle((0,0),MAP_W * scale,MAP_H * scale,BLACK))
    5349        blockMap.addEntry(landscape)
    5450       
  • src/color.py

    r108 r157  
    77
    88# color constants (RBG)
     9WHITE = (255,255,255)
    910BLACK = (0,0,0)
    1011FAKEBLACK = (0,0,1)
    11 WHITE = (255,255,255)
    1212RED = (255,0,0)
    1313GREEN = (0,255,0)
    14 LIGHT_GREEN = (85, 255, 85)
    1514BLUE = (0,0,255)
    1615MAGENTA = (255,0,255)
     
    1817CYAN = (0,255,255)
    1918MAUVE = (224,176,255)
    20 GRAYBLUE = (72,209,204)
    2119GRAY = (172,172,172)
    2220
    23 # functions for manipulating colors
     21
    2422def dynamicColor(value, isBad = False):
     23    """
     24        calculates color intensity; isBad is if high values are bad (i.e., red)
     25       
     26        input type: value, bool
     27        return type: (int, int, int)
     28    """
    2529    if value >= 100:
    2630        green = 255 - (200 - value)
     
    2933        red = 255 - value
    3034        green = blue = 0
     35       
     36    # switch red and black
    3137    if isBad:
    3238        return validColor(green, red, blue)
     
    3541
    3642def validColor(red, green, blue):
     43    """
     44        ensures valid color [0,255]
     45       
     46        input type: int, int, int
     47        return type: (int, int, int)
     48    """
    3749    red = min(max(0, red), 255)
    3850    green = min(max(0, green), 255)
    3951    blue = min(max(0, blue), 255)
     52   
    4053    return (red, green, blue)
    4154   
  • src/map.py

    r147 r157  
    6868            if i == self.currentBlock:
    6969                jumpButton = WindowEntry(Response('windows',['blockMap_' + str(i)],False,False))
    70                 jumpButton.addRectangle(Rectangle((5 * scale + 20 * scale * i - 5,MAP_H * scale + 5),30,30,self.blockList[i].myColor))
     70                jumpButton.addRectangle(Rectangle((5 * scale + 20 * scale * i - 5,MAP_H * scale + 5),30,30,self.blockList[i].BLACK))
    7171                jumpButton.addImage(Image((5 * scale + 20 * scale * i - 5,MAP_H * scale + 5),30,30,landscapeArt))
    7272                smallMap.addEntry(jumpButton)
     
    7575            else:
    7676                jumpButton = WindowEntry(Response('windows',['blockMap_' + str(i)],True,False))
    77                 jumpButton.addRectangle(Rectangle((5 * scale + 20 * scale * i,MAP_H * scale + 10),20,20,self.blockList[i].myColor))
     77                jumpButton.addRectangle(Rectangle((5 * scale + 20 * scale * i,MAP_H * scale + 10),20,20,self.blockList[i].BLACK))
    7878                jumpButton.addImage(Image((5 * scale + 20 * scale * i,MAP_H * scale + 10),20,20,landscapeArt))
    7979                smallMap.addEntry(jumpButton)
Note: See TracChangeset for help on using the changeset viewer.