phetsims / normal-modes

"Normal Modes" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 2 forks source link

factor out duplicated colors #47

Closed pixelzoom closed 4 years ago

pixelzoom commented 4 years ago

Related to #2 (code review).

Colors are duplicated in multiple places. Recommended to factor them out into NormalModeColors.js.

Examples (not necessarily a complete list):

fill: '#007bff',
stroke: Color.toColor( '#007bff' ).colorUtilsDarker( .6 ),
stroke: 'red',
fill: Color.toColor( '#ffffff' ),
this.strokeColor = options.strokeColor || 'blue'; // @private
this.refLineStrokeColor = options.refLineStrokeColor || 'black'; // @private

And these colors could then be moved from NormalModesConstants.js to NormalModesColors.js:

    BLUE_BTN_UP_COLOR: new Color( 'hsl(210,70%,75%)' ),
    BLUE_BTN_OVER_COLOR: new Color( 'hsl(210,90%,80%)' ),
    BLUE_BTN_DISABLED_COLOR: new Color( 'rgb(180,180,180)' ),
    BLUE_BTN_DOWN_COLOR: new Color( 'hsl(210,80%,70%)' ),
    BLUE_BTN_BORDER_0: new Color( 'transparent' ),
    BLUE_BTN_BORDER_1: new Color( 'transparent' ),

    // color scheme for panels in the whole sim
    PANEL_COLORS: {
      stroke: 'rgb( 190, 190, 190 )',
      fill: 'rgb( 240, 240, 240 )'
    }
tmildemberger commented 4 years ago

I was not sure if I should move all the colors to NormalModesColors.js or just the duplicated ones. In the above commit I ended up moving all the colors to make finding and changing any color easier. Assigning @pixelzoom for review.

pixelzoom commented 4 years ago

Very nice! Closing.