''
'' Theme based off of the colors used by Amazon Web Services
''
'' Author: Brett Schwarz
''
!$PUML_THEME = "aws-orange"
!$THEME      = "aws-orange"
''
'' User can specify the PUML_BGCOLOR via command line or set this variable before
'' loading this theme file. PUML_BGCOLOR is the background color of the image that is 
'' generated by plantuml
''
!if %not(%variable_exists("$PUML_BGCOLOR"))
    !$PUML_BGCOLOR = "transparent"
!endif
''
'' If no gradient is given, default to 20
''
!if %not(%variable_exists("$PUML_GRADIENT"))
    !$PUML_GRADIENT = 20
!endif
''
'' User can specify the PUML_MODE via command line or set this variable before
'' loading this theme file. PUML_MODE is either 'light' PUML_MODE or 'dark' PUML_MODE.
''
!if %not(%variable_exists("$PUML_MODE"))
    !$PUML_MODE = "light"
!endif
''
'' User can specify the PUML_OUTLINE via command line or set this variable before
'' loading this theme file. PUML_OUTLINE is either 'true' or 'false'.
''
!if %not(%variable_exists("$PUML_OUTLINE"))
    !$PUML_OUTLINE = "false"
!endif
''
skinparam BackgroundColor $PUML_BGCOLOR
skinparam useBetaStyle false
''
'' Supplementary Colors
''
!$WHITE      = "#FFF"
!$GRAY_LIGHT = "#222"
!$GRAY       = "#868e96"
!$PRIMARY    = "#EC7211"
!$WARNING    = "#EC7211"
!$LIGHT      = "#abb6c2"
!$DARK       = "#4E5D6C"
''
'' define colors based on PUML_MODE
''
!if ($PUML_MODE == "light")
    !$SECONDARY      = "#eeeeee"
    '' hardcode $SECONDARY_LIGHT since it is so close to white
    !$SECONDARY_LIGHT = "ffffff"
    !$SUCCESS        = "#1D8102"
    !$INFO           = "#0073bb"
    !$DANGER         = "#d13212"
    !$SECONDARY_TEXT = $DARK
    !$FGCOLOR        = $DARK
	!$DIAMOND_BD     = %darken($SECONDARY, $PUML_GRADIENT)
    ''
    '' Assume if the background is transparent, that the 
    '' background will be dark for this theme
    ''
    !assume transparent light
!else
    !$SECONDARY      = "#2a2e33"
    !$SECONDARY_LIGHT = %lighten($SECONDARY, $PUML_GRADIENT)
    !$SUCCESS        = "#6aaf35"
    !$INFO           = "#44b9d6"
    !$DANGER         = "#ff5d64"
    !$SECONDARY_TEXT = $WHITE
    !$FGCOLOR        = $WHITE
	!$DIAMOND_BD     = %lighten($SECONDARY, $PUML_GRADIENT)
    ''
    '' Assume if the background is transparent, that the 
    '' background will be dark for this theme
    ''
    !assume transparent dark
!endif
''
'' *_DARK = tint (lighter) of the main color 
'' *_LIGHT = shade (darker) of the main color
''
!$PRIMARY_DARK    = %darken($PRIMARY, $PUML_GRADIENT)
!$PRIMARY_LIGHT   = %lighten($PRIMARY, $PUML_GRADIENT)
!$SECONDARY_DARK  = %darken($SECONDARY, $PUML_GRADIENT)
!$SUCCESS_DARK    = %darken($SUCCESS, $PUML_GRADIENT)
!$SUCCESS_LIGHT   = %lighten($SUCCESS, $PUML_GRADIENT)
!$INFO_DARK       = %darken($INFO, $PUML_GRADIENT)
!$INFO_LIGHT      = %lighten($INFO, $PUML_GRADIENT)
!$DANGER_DARK     = %darken($DANGER, $PUML_GRADIENT)
!$DANGER_LIGHT    = %lighten($DANGER, $PUML_GRADIENT)
!$WARNING_DARK    = %darken($WARNING, $PUML_GRADIENT)
!$WARNING_LIGHT   = %lighten($WARNING, $PUML_GRADIENT)
!$DARK_DARK       = %darken($DARK, $PUML_GRADIENT)
!$DARK_LIGHT      = %lighten($DARK, $PUML_GRADIENT)
!$LIGHT_DARK      = %darken($LIGHT, $PUML_GRADIENT)
!$LIGHT_LIGHT     = %lighten($LIGHT, $PUML_GRADIENT)
''
'' Set text colors
''
!$INFO_TEXT    = $WHITE
!$SUCCESS_TEXT = $WHITE
!$WARNING_TEXT = $WHITE
!$DANGER_TEXT  = $WHITE
''
'' Called to make the text in the color of SUCCESS
''
!procedure $success($msg)
  <font color=$SUCCESS><b>$msg
!endprocedure
''
'' Called to make the text in the color of DANGER
''
!procedure $failure($msg)
  <font color=$DANGER><b>$msg
!endprocedure
''
'' Called to make the text in the color of WARNING
''
!procedure $warning($msg)
  <font color=$WARNING><b>$msg
!endprocedure
''
'' Called to use the primary color scheme
'' Different colors based on if PUML_OUTLINE
'' is true or not
''
!procedure $primary_scheme()
	!if ($PUML_OUTLINE == "true")
		FontColor $PRIMARY
		BorderColor $PRIMARY
		BackgroundColor $PUML_BGCOLOR
	!else
		FontColor $PRIMARY_TEXT
		BorderColor $PRIMARY
		BackgroundColor $PRIMARY_LIGHT-$PRIMARY
	!endif
!endprocedure
''
'' Called to use the secondary color scheme
''
!procedure $secondary_scheme()
	!if ($PUML_OUTLINE == "true")
		FontColor $SECONDARY_DARK
		BorderColor $SECONDARY_DARK
		BackgroundColor $PUML_BGCOLOR
	!else
		FontColor $SECONDARY_TEXT
		BorderColor $SECONDARY_DARK
		BackgroundColor $SECONDARY_LIGHT-$SECONDARY
	!endif
!endprocedure
''
!if ($PUML_OUTLINE == "true")
	!$HEADER_TEXT  = $PRIMARY_TEXT
	!$PRIMARY_TEXT = $PRIMARY_LIGHT
	!$INFO_TEXT    = $INFO_LIGHT
	!$WARNING_TEXT = $WARNING_LIGHT
	!$DARK_BG      = $PUML_BGCOLOR
	!$INFO_BG      = $PUML_BGCOLOR
	!$DANGER_BG    = $PUML_BGCOLOR
	!$WARNING_BG   = $PUML_BGCOLOR
	!$SECONDARY_BG = $PUML_BGCOLOR
!else
	!$DARK_BG      = $DARK
	!$INFO_BG      = $INFO
	!$DANGER_BG    = $DANGER
	!$WARNING_BG   = $WARNING
	!$SECONDARY_BG = $SECONDARY
!endif
''
'' HTTP Methods
''
!_POST   = "<color #007a3e>POST</color>"
!_PUT    = "<color #ea7400>PUT</color>"
!_DELETE = "<color #cf2a2a>DELETE</color>"
!_GET    = "<color #009fdb>GET</color>"
!_PATCH  = "<color #b5bd00>PATCH</color>"
!_HEAD   = "<color #9012fe>HEAD</color>"
''
'' Global Default Values
''
skinparam defaultFontName       "Verdana"
skinparam defaultFontSize       12
skinparam dpi                   100
skinparam shadowing             false
skinparam roundcorner           8
skinparam ParticipantPadding    40
skinparam BoxPadding            40
skinparam Padding               5
skinparam ArrowColor            $DARK
skinparam stereotype {
    CBackgroundColor $SECONDARY_LIGHT
    CBorderColor $SECONDARY_DARK
    ABackgroundColor $SUCCESS_LIGHT
    ABorderColor $SUCCESS_DARK
    IBackgroundColor $DANGER_LIGHT
    IBorderColor $DANGER_DARK
    EBackgroundColor $WARNING_LIGHT
    EBorderColor $WARNING_DARK
    NBackgroundColor $INFO_LIGHT
    NBorderColor $INFO_DARK
}
skinparam title {
	FontSize	    	         20
	BorderRoundCorner            8
	BorderThickness 	         1
	BackgroundColor  $SECONDARY_LIGHT-$SECONDARY
	FontColor $PRIMARY
	BorderColor $SECONDARY
}

skinparam legend {
    $secondary_scheme()
    BackgroundColor transparent
}

!startsub swimlane
skinparam swimlane {
	BorderColor $INFO
	BorderThickness 2
	TitleBackgroundColor  $SECONDARY_LIGHT-$SECONDARY
	TitleFontColor $PRIMARY
}
!endsub

' <style> 
' mindmapDiagram {
' 	Padding 15
' 	Margin 10
' 	FontSize 12
' 	FontName Verdana
' 	Shadowing 0.0
' 	LineThickness 1.5
' 	FontColor $PRIMARY_TEXT
' 	LineColor $PRIMARY_DARK
'     node {
' 	    LineColor $PRIMARY
' 	    BackGroundColor $PRIMARY_LIGHT-$PRIMARY
'     }
' }
' </style>

!startsub activity
skinparam activity {
	$primary_scheme()
	BarColor $SUCCESS
	StartColor $INFO
	EndColor $INFO
	''
	DiamondBackgroundColor $SECONDARY_BG
  	DiamondBorderColor $DIAMOND_BD
  	DiamondFontColor $SECONDARY_TEXT
}
!endsub

!startsub participant
skinparam participant {
	$primary_scheme()
	ParticipantBorderThickness 2
}
!endsub

!startsub actor
skinparam actor {
	$primary_scheme()
	FontColor $FGCOLOR
}
!endsub

!startsub arrow
skinparam arrow {
	Thickness 3
	Color $PRIMARY
	FontColor $FGCOLOR
}
!endsub

!startsub sequence
skinparam sequence {
	ArrowThickness 3
	BorderColor $PRIMARY
	' For some reason sequence title font color does not pick up from global
	TitleFontColor $PRIMARY
	BackgroundColor $PUML_BGCOLOR
	StartColor $PRIMARY
	EndColor $PRIMARY
	''
	BoxBackgroundColor $PUML_BGCOLOR
	BoxBorderColor $DARK
	BoxFontColor $DARK
	''
	DelayFontColor $DARK
	''
	LifeLineBorderColor $LIGHT
	LifeLineBorderThickness 2
	LifeLineBackgroundColor $LIGHT_DARK
	''
	GroupBorderColor $DARK
	GroupFontColor $DARK
	GroupHeaderFontColor $INFO
	GroupBackgroundColor $SECONDARY
	GroupBodyBackgroundColor $PUML_BGCOLOR
	GroupHeaderBackgroundColor $PUML_BGCOLOR
	''
	DividerBackgroundColor $DARK
    DividerBorderColor $DARK
    DividerBorderThickness 2
    DividerFontColor $LIGHT
	''
	ReferenceBackgroundColor $PUML_BGCOLOR
	ReferenceBorderColor $DARK
	ReferenceFontColor $DARK
	ReferenceHeaderFontColor $INFO
	ReferenceHeaderBackgroundColor $SECONDARY
	''
	StereotypeFontColor $PRIMARY_TEXT
	StereotypeFontSize 12
}
!endsub

!startsub partition
skinparam partition {
	BorderColor $PRIMARY
	FontColor $PRIMARY
	BackgroundColor $PUML_BGCOLOR
}
!endsub

!startsub collections
skinparam collections {
	$primary_scheme()
}
!endsub

!startsub control
skinparam control {
	$primary_scheme()
	FontColor $DARK
}
!endsub

!startsub entity
skinparam entity {
	$primary_scheme()
	FontColor $DARK
}
!endsub

!startsub boundary
skinparam boundary {
	$primary_scheme()
	FontColor $DARK
}
!endsub

!startsub agent
skinparam agent {
	BackgroundColor $WARNING
	BorderColor $WARNING_LIGHT
	FontColor $DARK
}
!endsub

!startsub note
skinparam note {
	BorderThickness 1
	BackgroundColor $INFO_BG
	BorderColor $INFO_DARK
	FontColor $INFO_TEXT
}
!endsub

!startsub artifact
skinparam artifact {
	BackgroundColor $DARK_BG
	BorderColor $DARK_DARK
	FontColor $LIGHT
}
!endsub

!startsub component
skinparam component {
	$primary_scheme()
}
!endsub

!startsub interface
skinparam interface {
	BackgroundColor  $DANGER_DARK
	BorderColor  $DANGER
	FontColor $DARK
}
!endsub

!startsub storage
skinparam storage {
	BackgroundColor $WARNING_BG
  	BorderColor $WARNING_DARK
	FontColor $WARNING_TEXT
}
!endsub

!startsub node
skinparam node {
	BackgroundColor  $PUML_BGCOLOR
	BorderColor $LIGHT
	FontColor $LIGHT
}
!endsub

!startsub cloud
skinparam cloud {
	BackgroundColor transparent
	BorderColor $DARK
	FontColor $FGCOLOR
}
!endsub

!startsub database
skinparam database {
	$primary_scheme()
	FontColor $FGCOLOR
	StereotypeFontColor $FGCOLOR
}
!endsub

!startsub class
skinparam class {
	$primary_scheme()
	FontColor $HEADER_TEXT
	HeaderBackgroundColor $PRIMARY_LIGHT-$PRIMARY
	StereotypeFontColor $DARK
	BorderThickness 1
	AttributeFontColor $PRIMARY_TEXT
	AttributeFontSize 11
}
!endsub

!startsub object
skinparam object {
	$primary_scheme()
	StereotypeFontColor $DARK
	BorderThickness 1
	AttributeFontColor $PRIMARY_TEXT
	AttributeFontSize 11
}
!endsub

!startsub usecase
skinparam usecase {
	$primary_scheme()
	BorderThickness 2
	StereotypeFontColor $PRIMARY
}
!endsub

!startsub rectangle
skinparam rectangle {
	BackgroundColor $PUML_BGCOLOR
	FontColor $SECONDARY_TEXT
	BorderColor $SECONDARY_TEXT
	BorderThickness 2
	StereotypeFontColor $PRIMARY
}
!endsub

!startsub package
skinparam package {
	BackgroundColor $PUML_BGCOLOR
  	BorderColor $SECONDARY_TEXT
	FontColor $SECONDARY_TEXT
	BorderThickness 2
}
!endsub

!startsub folder
skinparam folder {
	BackgroundColor $SECONDARY_BG
  	BorderColor $WARNING
	FontColor $WARNING
	BorderThickness 2
}
!endsub

!startsub frame
skinparam frame {
	BackgroundColor $SECONDARY_BG
  	BorderColor $INFO
	FontColor $INFO
	BorderThickness 2
}
!endsub

!startsub state
skinparam state {
	$primary_scheme()
	StartColor $INFO
	EndColor $INFO
	AttributeFontColor $SECONDARY_TEXT
	AttributeFontSize 11
}
!endsub

!startsub queue
skinparam queue {
	$primary_scheme()
}
!endsub

!startsub card
skinparam card {
	BackgroundColor $INFO_BG
	BorderColor $INFO_DARK
	FontColor $INFO_TEXT
}
!endsub

!startsub file
skinparam file {
	BackgroundColor $SECONDARY_BG
	BorderColor $LIGHT
	FontColor $FGCOLOR
}
!endsub

!startsub stack

skinparam stack {
	$primary_scheme()
}

!endsub