Skip to content

Commit

Permalink
Rename from simColorProfileProperty to SimColors.js, see phetsims/sce…
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jul 28, 2021
1 parent 43018aa commit 796314e
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 71 deletions.
6 changes: 3 additions & 3 deletions js/common/RSColorProfile.js → js/common/RSColors.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import rutherfordScattering from '../rutherfordScattering.js';
// Initial colors for each profile, by string key. If a projector color is not defined, it will take
// the 'default' value provided.
// NOTE: This is NOT provided to clients directly, but each of these are passed to the Property constructor.
const RSColorProfile = {
const RSColors = {
backgroundColorProperty: new ProfileColorProperty( 'backgroundColor', {
default: new Color( 0, 0, 0 ),
projector: new Color( 255, 255, 255 )
Expand Down Expand Up @@ -82,6 +82,6 @@ const RSColorProfile = {
} )
};

rutherfordScattering.register( 'RSColorProfile', RSColorProfile );
rutherfordScattering.register( 'RSColors', RSColors );

export default RSColorProfile;
export default RSColors;
30 changes: 15 additions & 15 deletions js/common/view/AlphaParticlePropertiesPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import HSlider from '../../../../sun/js/HSlider.js';
import Panel from '../../../../sun/js/Panel.js';
import rutherfordScattering from '../../rutherfordScattering.js';
import rutherfordScatteringStrings from '../../rutherfordScatteringStrings.js';
import RSColorProfile from '../RSColorProfile.js';
import RSColors from '../RSColors.js';
import RSConstants from '../RSConstants.js';

// constants
Expand Down Expand Up @@ -53,7 +53,7 @@ class AlphaParticlePropertiesPanel extends Panel {
const alphaParticlePropertiesText = new Text( alphaParticlePropertiesString, {
font: RSConstants.PANEL_TITLE_FONT,
fontWeight: 'bold',
fill: RSColorProfile.panelTitleColorProperty,
fill: RSColors.panelTitleColorProperty,
maxWidth: 215
} );

Expand All @@ -69,8 +69,8 @@ class AlphaParticlePropertiesPanel extends Panel {
minWidth: RSConstants.PANEL_MIN_WIDTH,
maxWidth: RSConstants.PANEL_MAX_WIDTH,
align: 'center',
fill: RSColorProfile.panelColorProperty,
stroke: RSColorProfile.panelBorderColorProperty,
fill: RSColors.panelColorProperty,
stroke: RSColors.panelBorderColorProperty,

// pdom
tagName: 'div',
Expand Down Expand Up @@ -128,25 +128,25 @@ class AlphaParticlePropertiesPanelContent extends VBox {
minWidth: RSConstants.PANEL_MIN_WIDTH,
maxWidth: RSConstants.PANEL_MAX_WIDTH,
align: 'left',
fill: RSColorProfile.panelColorProperty,
stroke: RSColorProfile.panelBorderColorProperty
fill: RSColors.panelColorProperty,
stroke: RSColors.panelBorderColorProperty
}, options );

const energyText = new Text( energyString, {
font: RSConstants.PANEL_PROPERTY_FONT,
fontWeight: 'bold',
fill: RSColorProfile.panelLabelColorProperty,
fill: RSColors.panelLabelColorProperty,
maxWidth: 210
} );
const minEnergyText = new Text( minEnergyString, {
font: RSConstants.PANEL_TICK_FONT,
fill: RSColorProfile.panelSliderLabelColorProperty,
fill: RSColors.panelSliderLabelColorProperty,
maxWidth: options.maxWidth / 5,
pickable: false
} );
const maxEnergyText = new Text( maxEnergyString, {
font: RSConstants.PANEL_TICK_FONT,
fill: RSColorProfile.panelSliderLabelColorProperty,
fill: RSColors.panelSliderLabelColorProperty,
maxWidth: options.maxWidth / 5,
pickable: false
} );
Expand Down Expand Up @@ -187,9 +187,9 @@ class AlphaParticlePropertiesPanelContent extends VBox {
RSConstants.MIN_ALPHA_ENERGY,
RSConstants.MAX_ALPHA_ENERGY
), {
trackFill: RSColorProfile.panelSliderLabelColorProperty,
trackStroke: RSColorProfile.panelSliderLabelColorProperty,
majorTickStroke: RSColorProfile.panelSliderLabelColorProperty,
trackFill: RSColors.panelSliderLabelColorProperty,
trackStroke: RSColors.panelSliderLabelColorProperty,
majorTickStroke: RSColors.panelSliderLabelColorProperty,
majorTickLength: 15,
tickLabelSpacing: 2,
trackSize: new Dimension2( sliderWidth, 1 ),
Expand Down Expand Up @@ -227,12 +227,12 @@ class AlphaParticlePropertiesPanelContent extends VBox {
const showTraceText = new Text( showTracesString, {
font: RSConstants.PANEL_PROPERTY_FONT,
fontWeight: 'bold',
fill: RSColorProfile.panelLabelColorProperty,
fill: RSColors.panelLabelColorProperty,
maxWidth: 180
} );
const showTraceCheckbox = new Checkbox( showTraceText, showTracesProperty, {
checkboxColor: RSColorProfile.panelLabelColorProperty,
checkboxColorBackground: RSColorProfile.panelColorProperty,
checkboxColor: RSColors.panelLabelColorProperty,
checkboxColorBackground: RSColors.panelColorProperty,

// pdom
labelContent: tracesString,
Expand Down
14 changes: 7 additions & 7 deletions js/common/view/ParticleLegendPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import VBox from '../../../../scenery/js/nodes/VBox.js';
import Panel from '../../../../sun/js/Panel.js';
import rutherfordScattering from '../../rutherfordScattering.js';
import rutherfordScatteringStrings from '../../rutherfordScatteringStrings.js';
import RSColorProfile from '../RSColorProfile.js';
import RSColors from '../RSColors.js';
import RSConstants from '../RSConstants.js';

const legendString = rutherfordScatteringStrings.legend;
Expand All @@ -36,7 +36,7 @@ class ParticleLegendPanel extends Panel {
const legendText = new Text( legendString, {
font: RSConstants.PANEL_TITLE_FONT,
fontWeight: 'bold',
fill: RSColorProfile.panelTitleColorProperty,
fill: RSColors.panelTitleColorProperty,
maxWidth: 225
} );

Expand All @@ -53,8 +53,8 @@ class ParticleLegendPanel extends Panel {
minWidth: RSConstants.PANEL_MIN_WIDTH,
maxWidth: RSConstants.PANEL_MAX_WIDTH,
align: 'left',
fill: RSColorProfile.panelColorProperty,
stroke: RSColorProfile.panelBorderColorProperty,
fill: RSColors.panelColorProperty,
stroke: RSColors.panelBorderColorProperty,
itemVerticalSpacing: RSConstants.PANEL_CHILD_SPACING
}, options );

Expand Down Expand Up @@ -95,7 +95,7 @@ const createParticleRow = ( particleNode, titleString ) => {
const hStrut1 = new HStrut( LEGEND_ITEM_HORIZONTAL_SPACING - particleNode.width / 2 );
const titleText = new Text( titleString, {
font: RSConstants.PANEL_PROPERTY_FONT,
fill: RSColorProfile.panelLabelColorProperty,
fill: RSColors.panelLabelColorProperty,
maxWidth: 175
} );
const hStrut2 = new HStrut( LEGEND_ITEM_HORIZONTAL_SPACING - particleNode.width / 2 );
Expand Down Expand Up @@ -131,8 +131,8 @@ class ParticleLegendPanelContent extends VBox {
minWidth: RSConstants.PANEL_MIN_WIDTH,
maxWidth: RSConstants.PANEL_MAX_WIDTH,
align: 'left',
fill: RSColorProfile.panelColorProperty,
stroke: RSColorProfile.panelBorderColorProperty,
fill: RSColors.panelColorProperty,
stroke: RSColors.panelBorderColorProperty,
itemVerticalSpacing: RSConstants.PANEL_CHILD_SPACING
}, options );

Expand Down
4 changes: 2 additions & 2 deletions js/common/view/ParticleNodeFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Node from '../../../../scenery/js/nodes/Node.js';
import RadialGradient from '../../../../scenery/js/util/RadialGradient.js';
import plumPuddingImage from '../../../images/plumPuddingIcon_png.js';
import rutherfordScattering from '../../rutherfordScattering.js';
import RSColorProfile from '../RSColorProfile.js';
import RSColors from '../RSColors.js';

// constants
const SPECULAR_HIGHLITE_COLOR = 'rgb(200,200,200)';
Expand Down Expand Up @@ -103,7 +103,7 @@ const ParticleNodeFactory = {
createNucleus() {
return new Node( {
children: [
new Circle( NUCLEUS_RADIUS, { fill: RSColorProfile.nucleusColorProperty } )
new Circle( NUCLEUS_RADIUS, { fill: RSColors.nucleusColorProperty } )
]
} );
},
Expand Down
4 changes: 2 additions & 2 deletions js/common/view/ParticleSpaceNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import StringUtils from '../../../../phetcommon/js/util/StringUtils.js';
import CanvasNode from '../../../../scenery/js/nodes/CanvasNode.js';
import Color from '../../../../scenery/js/util/Color.js';
import rutherfordScattering from '../../rutherfordScattering.js';
import RSColorProfile from '../RSColorProfile.js';
import RSColors from '../RSColors.js';
import RSConstants from '../RSConstants.js';
import ParticleNodeFactory from './ParticleNodeFactory.js';

Expand Down Expand Up @@ -125,7 +125,7 @@ class ParticleSpaceNode extends CanvasNode {
// viewport clip
context.beginPath();
context.strokeStyle = 'transparent';
context.fillStyle = RSColorProfile.backgroundColorProperty.get().toCSS();
context.fillStyle = RSColors.backgroundColorProperty.get().toCSS();
context.rect( this.clipRect.x, this.clipRect.y, this.clipRect.width, this.clipRect.height );
context.stroke();
context.fill();
Expand Down
6 changes: 3 additions & 3 deletions js/common/view/RSBaseScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Path from '../../../../scenery/js/nodes/Path.js';
import Text from '../../../../scenery/js/nodes/Text.js';
import rutherfordScattering from '../../rutherfordScattering.js';
import rutherfordScatteringStrings from '../../rutherfordScatteringStrings.js';
import RSColorProfile from '../RSColorProfile.js';
import RSColors from '../RSColors.js';
import RSConstants from '../RSConstants.js';
import BeamNode from './BeamNode.js';
import RSControlPanel from './RSControlPanel.js';
Expand Down Expand Up @@ -86,7 +86,7 @@ class RSBaseScreenView extends ScreenView {
centerX: this.gunNode.centerX,
top: this.gunNode.bottom + 15,
font: new PhetFont( 15 ),
fill: RSColorProfile.panelLabelColorProperty,
fill: RSColors.panelLabelColorProperty,
maxWidth: 210
} );
this.addChild( alphaParticlesText );
Expand All @@ -95,7 +95,7 @@ class RSBaseScreenView extends ScreenView {
this.beamNode = new BeamNode( model.gun.onProperty, {
centerX: this.gunNode.centerX,
bottom: this.gunNode.top,
fill: RSColorProfile.atomBeamColorProperty
fill: RSColors.atomBeamColorProperty
} );
this.addChild( this.beamNode );

Expand Down
12 changes: 6 additions & 6 deletions js/common/view/ScaleInfoNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Node from '../../../../scenery/js/nodes/Node.js';
import Path from '../../../../scenery/js/nodes/Path.js';
import RichText from '../../../../scenery/js/nodes/RichText.js';
import rutherfordScattering from '../../rutherfordScattering.js';
import RSColorProfile from '../RSColorProfile.js';
import RSColors from '../RSColors.js';
import RSConstants from '../RSConstants.js';

// constants
Expand All @@ -38,7 +38,7 @@ class ScaleInfoNode extends Node {
// scale text
const labelText = new RichText( label, {
font: options.font,
fill: RSColorProfile.panelLabelColorProperty,
fill: RSColors.panelLabelColorProperty,
maxWidth: 0.9 * width
} );

Expand All @@ -50,7 +50,7 @@ class ScaleInfoNode extends Node {
headHeight: ARROW_HEAD_HEIGHT,
headWidth: ARROW_HEAD_WIDTH,
tailWidth: 2,
fill: RSColorProfile.panelLabelColorProperty
fill: RSColors.panelLabelColorProperty
} );

// right arrow
Expand All @@ -60,17 +60,17 @@ class ScaleInfoNode extends Node {
headHeight: ARROW_HEAD_HEIGHT,
headWidth: ARROW_HEAD_WIDTH,
tailWidth: 2,
fill: RSColorProfile.panelLabelColorProperty
fill: RSColors.panelLabelColorProperty
} );

// end markers
const leftMarker = new Path( new Shape().moveTo( leftArrowX, labelText.bounds.minY ).lineTo( leftArrowX, labelText.bounds.maxY ), {
stroke: RSColorProfile.panelLabelColorProperty,
stroke: RSColors.panelLabelColorProperty,
lineWidth: 1.5
} );

const rightMarker = new Path( new Shape().moveTo( rightArrowX, labelText.bounds.minY ).lineTo( rightArrowX, labelText.bounds.maxY ), {
stroke: RSColorProfile.panelLabelColorProperty,
stroke: RSColors.panelLabelColorProperty,
lineWidth: 1.5
} );

Expand Down
6 changes: 3 additions & 3 deletions js/plumpuddingatom/PlumPuddingAtomScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Screen from '../../../joist/js/Screen.js';
import ScreenIcon from '../../../joist/js/ScreenIcon.js';
import Image from '../../../scenery/js/nodes/Image.js';
import screenIcon from '../../images/PlumPuddingAtom-screen-icon_png.js';
import RSColorProfile from '../common/RSColorProfile.js';
import RSColors from '../common/RSColors.js';
import rutherfordScattering from '../rutherfordScattering.js';
import rutherfordScatteringStrings from '../rutherfordScatteringStrings.js';
import PlumPuddingAtomModel from './model/PlumPuddingAtomModel.js';
Expand All @@ -21,11 +21,11 @@ class PlumPuddingAtomScreen extends Screen {

const options = {
name: rutherfordScatteringStrings.plumPuddingAtom,
backgroundColorProperty: RSColorProfile.backgroundColorProperty,
backgroundColorProperty: RSColors.backgroundColorProperty,
homeScreenIcon: new ScreenIcon( new Image( screenIcon ), {
maxIconWidthProportion: 1,
maxIconHeightProportion: 1,
fill: RSColorProfile.screenIconFillColorProperty
fill: RSColors.screenIconFillColorProperty
} )
};

Expand Down
6 changes: 3 additions & 3 deletions js/rutherford-scattering-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Sim from '../../joist/js/Sim.js';
import simLauncher from '../../joist/js/simLauncher.js';
import HighlightOverlay from '../../scenery/js/overlays/HighlightOverlay.js';
import RSColorProfile from './common/RSColorProfile.js';
import RSColors from './common/RSColors.js';
import MenuOptionsNode from './common/view/MenuOptionsNode.js';
import PlumPuddingAtomScreen from './plumpuddingatom/PlumPuddingAtomScreen.js';
import rutherfordScatteringStrings from './rutherfordScatteringStrings.js';
Expand All @@ -33,8 +33,8 @@ const simOptions = {
};

// group focus highlights are synced with color profile
HighlightOverlay.setInnerGroupHighlightColor( RSColorProfile.innerGroupHighlightColorProperty );
HighlightOverlay.setOuterGroupHighlightColor( RSColorProfile.outerGroupHighlightColorProperty );
HighlightOverlay.setInnerGroupHighlightColor( RSColors.innerGroupHighlightColorProperty );
HighlightOverlay.setOuterGroupHighlightColor( RSColors.outerGroupHighlightColorProperty );

simLauncher.launch( () => {
const screens = [
Expand Down
6 changes: 3 additions & 3 deletions js/rutherfordatom/RutherfordAtomScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Screen from '../../../joist/js/Screen.js';
import ScreenIcon from '../../../joist/js/ScreenIcon.js';
import RSColorProfile from '../common/RSColorProfile.js';
import RSColors from '../common/RSColors.js';
import RSConstants from '../common/RSConstants.js';
import rutherfordScattering from '../rutherfordScattering.js';
import rutherfordScatteringStrings from '../rutherfordScatteringStrings.js';
Expand All @@ -23,12 +23,12 @@ class RutherfordAtomScreen extends Screen {
const homeScreenIcon = new ScreenIcon( RutherfordNucleusNode.RutherfordNucleusIcon(
RSConstants.DEFAULT_PROTON_COUNT, RSConstants.DEFAULT_NEUTRON_COUNT
), {
fill: RSColorProfile.screenIconFillColorProperty
fill: RSColors.screenIconFillColorProperty
} );

const options = {
name: rutherfordScatteringStrings.rutherfordAtom,
backgroundColorProperty: RSColorProfile.backgroundColorProperty,
backgroundColorProperty: RSColors.backgroundColorProperty,
homeScreenIcon: homeScreenIcon
};

Expand Down
4 changes: 2 additions & 2 deletions js/rutherfordatom/view/AtomCollectionNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import Circle from '../../../../scenery/js/nodes/Circle.js';
import Node from '../../../../scenery/js/nodes/Node.js';
import Path from '../../../../scenery/js/nodes/Path.js';
import RSColorProfile from '../../common/RSColorProfile.js';
import RSColors from '../../common/RSColors.js';
import RSQueryParameters from '../../common/RSQueryParameters.js';
import ParticleNodeFactory from '../../common/view/ParticleNodeFactory.js';
import rutherfordScattering from '../../rutherfordScattering.js';
Expand Down Expand Up @@ -84,7 +84,7 @@ class AtomCollectionNode extends Node {
// nucleusColorProperty (used in ParticleNodeFactory.createNucleus()) and we link directly to that color rather
// than profileNameProperty so that we redraw the image if that color changes from
// rutherford-scattering-colors.hmtl. No need to unlink, this instance exists for life of sim
RSColorProfile.nucleusColorProperty.link( () => {
RSColors.nucleusColorProperty.link( () => {
drawAtomCollection();

// update the image
Expand Down
Loading

0 comments on commit 796314e

Please sign in to comment.