<commit_before>##########################################################################
#
#  Copyright (c) 2011-2012, <NAME>. All rights reserved.
#  Copyright (c) 2011-2014, Image Engine Design Inc. All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions are
#  met:
#
#      * Redistributions of source code must retain the above
#        copyright notice, this list of conditions and the following
#        disclaimer.
#
#      * Redistributions in binary form must reproduce the above
#        copyright notice, this list of conditions and the following
#        disclaimer in the documentation and/or other materials provided with
#        the distribution.
#
#      * Neither the name of <NAME> nor the names of
#        any other contributors to this software may be used to endorse or
#        promote products derived from this software without specific prior
#        written permission.
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
#  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
#  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
##########################################################################

import os
import string

from Qt import QtGui

_styleColors = {

	# The theme is built on the principal of using tonal variation and
	# subtle embossing instead of lines to differentiate UI elements.
	# There are a few holes in this, but it hopefully results in a lower overall
	# visual complexity compared to a flat + borders approach.
	#
	# The base background color for UI elements is $background, and this should
	# be used for 'default' height elements - ie: the main user interaction
	# surface background in any window/panel. This is usually a top-level
	# TabContainer or ListContainer. Depending on the nesting level of
	# subsequent elements, the Light/Lighter variants should be used instead.
	# Dark/Darker variants are for 'lower' elements, such as the background
	# behind something considered as the primary surface.
	#
	# For each base background color, in order to facilitate relief effects,
	# there are 'highlight' and 'lowlight' options. Highlight should be used
	# on top/left borders and lowlight on bottom/right.
	#
	# The 'alt' suffixed colors are for use in UI elements such as table views
	# that require subtle variation of the base background color.

	"backgroundDarkest" : (0, 0, 0),

	"backgroundDarker" : (35, 35, 35),

	"backgroundDark" : (52, 52, 52),
	"backgroundDarkTransparent" : (52, 52, 52, 100),
	"backgroundDarkHighlight" : (62, 62, 62),

	"backgroundLowlight" : (56, 56, 56),
	"backgroundMidLowlight" : (61, 61, 61),
	"background" : (66, 66, 66),
	"backgroundAlt" : (60, 60, 60),
	"backgroundHighlight" : (76, 76, 76),

	"backgroundRaisedLowlight" : (60, 60, 60),
	"backgroundRaised" : (72, 72, 72),
	"backgroundRaisedAlt" : (66, 66, 66),
	"backgroundRaisedHighlight" : (82, 82, 82),

	"backgroundLightLowlight" : (82, 82, 82),
	"backgroundLight" : (96, 96, 96),
	"backgroundLightHighlight" : (106, 106, 106),

	"backgroundLighter" : (125, 125, 125),

	# $brightColor should be used to illustrated a selected or highlighted
	# state, such as during a drag-hover or click-selection operation.

	"brightColor" : (119, 156, 189),
	"brightColorTransparent" : (119, 156, 189, 100),

	# $foreground is the standard Text/marker color.

	"foreground" : (224, 224, 224),
	"foregroundFaded" : (163, 163, 163),

	"errorColor" : (255, 85, 85),
	"animatedColor" : (128, 152, 94),

	"foregroundError" : ( 255, 80, 80 ),
	"foregroundWarning" : ( 239, 129, 24 ),
	"foregroundInfo" : ( 128, 179, 254 ),
	"foregroundDebug" : ( 163, 163, 163 ),

	# Controls and other UI elements may have to sit on a variety of background
	# colors and as such should make use of the $tint* colors for tonal
	# variation. This should be in preference to using $background* colors
	# unless there are compositing issues or other overriding reasons as the
	# control will not be portable across different backgrounds.

	"tintLighterSubtle" :   ( 255, 255, 255, 10 ),
	"tintLighter" :         ( 255, 255, 255, 20 ),
	"tintLighterStrong" :   ( 255, 255, 255, 40 ),
	"tintLighterStronger" : ( 255, 255, 255, 100 ),
	"tintDarkerSubtle" :    ( 0, 0, 0, 10 ),
	"tintDarker" :          ( 0, 0, 0, 20 ),
	"tintDarkerStrong" :    ( 0, 0, 0, 40 ),
	"tintDarkerStronger" :    ( 0, 0, 0, 70 ),

	# Value Inspectors

	"inspectorSourceUpstream" : ( 255, 255, 255, 20 ),
	"inspectorSourceEditScope" : ( 48, 100, 153, 60 ),
	"inspectorSourceDownstream" : ( 239, 198, 24, 104 ),

}

_themeVariables = {
	"roundedCornerRadius" : "6px",
	"widgetCornerRadius" : "4px",
	"controlCornerRadius" : "2px",
	"toolOverlayInset" : "44px",
	## \todo Use a font that we bundle with Gaffer, so that it's the same on all platforms.
	"monospaceFontFamily" : '"Menlo", "SFMono-Regular", "Consolas", "Liberation Mono", monospace'
}

substitutions = {
	"GAFFER_ROOT" : os.environ["GAFFER_ROOT"]
}

for k, v in _styleColors.items() :
	if len( v ) == 3 :
		substitutions[k] = "rgb({0}, {1}, {2})".format( *v )
	elif len( v ) == 4 :
		substitutions[k] = "rgba({0}, {1}, {2}, {3})".format( *v )

substitutions.update( _themeVariables )

def styleColor( key ) :
	color = _styleColors.get( key, (0, 0, 0,) )

	if len( color ) == 3 :
		return QtGui.QColor.fromRgb( *color )
	elif len( color ) == 4 :
		return QtGui.QColor.fromRgba( *color )

	return QtGui.QColor()

## \todo Unify with GafferUI.Style for colours at least.
_styleSheet = string.Template(
<commit_msg>GafferUI : Ensure forward slashes in Style Sheet<commit_after>##########################################################################
#
#  Copyright (c) 2011-2012, <NAME>. All rights reserved.
#  Copyright (c) 2011-2014, Image Engine Design Inc. All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions are
#  met:
#
#      * Redistributions of source code must retain the above
#        copyright notice, this list of conditions and the following
#        disclaimer.
#
#      * Redistributions in binary form must reproduce the above
#        copyright notice, this list of conditions and the following
#        disclaimer in the documentation and/or other materials provided with
#        the distribution.
#
#      * Neither the name of <NAME> nor the names of
#        any other contributors to this software may be used to endorse or
#        promote products derived from this software without specific prior
#        written permission.
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
#  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
#  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
##########################################################################

import os
import string

from Qt import QtGui

_styleColors = {

	# The theme is built on the principal of using tonal variation and
	# subtle embossing instead of lines to differentiate UI elements.
	# There are a few holes in this, but it hopefully results in a lower overall
	# visual complexity compared to a flat + borders approach.
	#
	# The base background color for UI elements is $background, and this should
	# be used for 'default' height elements - ie: the main user interaction
	# surface background in any window/panel. This is usually a top-level
	# TabContainer or ListContainer. Depending on the nesting level of
	# subsequent elements, the Light/Lighter variants should be used instead.
	# Dark/Darker variants are for 'lower' elements, such as the background
	# behind something considered as the primary surface.
	#
	# For each base background color, in order to facilitate relief effects,
	# there are 'highlight' and 'lowlight' options. Highlight should be used
	# on top/left borders and lowlight on bottom/right.
	#
	# The 'alt' suffixed colors are for use in UI elements such as table views
	# that require subtle variation of the base background color.

	"backgroundDarkest" : (0, 0, 0),

	"backgroundDarker" : (35, 35, 35),

	"backgroundDark" : (52, 52, 52),
	"backgroundDarkTransparent" : (52, 52, 52, 100),
	"backgroundDarkHighlight" : (62, 62, 62),

	"backgroundLowlight" : (56, 56, 56),
	"backgroundMidLowlight" : (61, 61, 61),
	"background" : (66, 66, 66),
	"backgroundAlt" : (60, 60, 60),
	"backgroundHighlight" : (76, 76, 76),

	"backgroundRaisedLowlight" : (60, 60, 60),
	"backgroundRaised" : (72, 72, 72),
	"backgroundRaisedAlt" : (66, 66, 66),
	"backgroundRaisedHighlight" : (82, 82, 82),

	"backgroundLightLowlight" : (82, 82, 82),
	"backgroundLight" : (96, 96, 96),
	"backgroundLightHighlight" : (106, 106, 106),

	"backgroundLighter" : (125, 125, 125),

	# $brightColor should be used to illustrated a selected or highlighted
	# state, such as during a drag-hover or click-selection operation.

	"brightColor" : (119, 156, 189),
	"brightColorTransparent" : (119, 156, 189, 100),

	# $foreground is the standard Text/marker color.

	"foreground" : (224, 224, 224),
	"foregroundFaded" : (163, 163, 163),

	"errorColor" : (255, 85, 85),
	"animatedColor" : (128, 152, 94),

	"foregroundError" : ( 255, 80, 80 ),
	"foregroundWarning" : ( 239, 129, 24 ),
	"foregroundInfo" : ( 128, 179, 254 ),
	"foregroundDebug" : ( 163, 163, 163 ),

	# Controls and other UI elements may have to sit on a variety of background
	# colors and as such should make use of the $tint* colors for tonal
	# variation. This should be in preference to using $background* colors
	# unless there are compositing issues or other overriding reasons as the
	# control will not be portable across different backgrounds.

	"tintLighterSubtle" :   ( 255, 255, 255, 10 ),
	"tintLighter" :         ( 255, 255, 255, 20 ),
	"tintLighterStrong" :   ( 255, 255, 255, 40 ),
	"tintLighterStronger" : ( 255, 255, 255, 100 ),
	"tintDarkerSubtle" :    ( 0, 0, 0, 10 ),
	"tintDarker" :          ( 0, 0, 0, 20 ),
	"tintDarkerStrong" :    ( 0, 0, 0, 40 ),
	"tintDarkerStronger" :    ( 0, 0, 0, 70 ),

	# Value Inspectors

	"inspectorSourceUpstream" : ( 255, 255, 255, 20 ),
	"inspectorSourceEditScope" : ( 48, 100, 153, 60 ),
	"inspectorSourceDownstream" : ( 239, 198, 24, 104 ),

}

_themeVariables = {
	"roundedCornerRadius" : "6px",
	"widgetCornerRadius" : "4px",
	"controlCornerRadius" : "2px",
	"toolOverlayInset" : "44px",
	## \todo Use a font that we bundle with Gaffer, so that it's the same on all platforms.
	"monospaceFontFamily" : '"Menlo", "SFMono-Regular", "Consolas", "Liberation Mono", monospace'
}

substitutions = {
	"GAFFER_ROOT" : os.environ["GAFFER_ROOT"].replace("\\", "/"),
}

for k, v in _styleColors.items() :
	if len( v ) == 3 :
		substitutions[k] = "rgb({0}, {1}, {2})".format( *v )
	elif len( v ) == 4 :
		substitutions[k] = "rgba({0}, {1}, {2}, {3})".format( *v )

substitutions.update( _themeVariables )

def styleColor( key ) :
	color = _styleColors.get( key, (0, 0, 0,) )

	if len( color ) == 3 :
		return QtGui.QColor.fromRgb( *color )
	elif len( color ) == 4 :
		return QtGui.QColor.fromRgba( *color )

	return QtGui.QColor()

## \todo Unify with GafferUI.Style for colours at least.
_styleSheet = string.Template(

{'fraction_non_alphanumeric': 0.13088837171976567, 'fraction_numerical': 0.05344675387208089, 'mean_word_length': 4.076171079429735, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7295678', 'n_tokens_mistral': 4555, 'n_tokens_neox': 3768, 'n_words': 1514}