@ -34,6 +34,7 @@ DiesalStyle.Formatters = DiesalStyle.Formatters or {}
-- ~~| DiesalStyle UpValues |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~| DiesalStyle UpValues |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
local AddonName = ...
local AddonName = ...
---@type table<Diesal.Style.Texture, boolean>
local ReleasedTextures = DiesalStyle.ReleasedTextures
local ReleasedTextures = DiesalStyle.ReleasedTextures
local TextureFrame = DiesalStyle.TextureFrame
local TextureFrame = DiesalStyle.TextureFrame
local Media = DiesalStyle.Media
local Media = DiesalStyle.Media
@ -42,6 +43,7 @@ local Formatters = DiesalStyle.Formatters
-- ~~| Locals |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~| Locals |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
local OUTLINES = { " _LEFT " , " _RIGHT " , " _TOP " , " _BOTTOM " }
local OUTLINES = { " _LEFT " , " _RIGHT " , " _TOP " , " _BOTTOM " }
---@diagnostic disable-next-line: undefined-global
local MEDIA_PATH = MEDIA_PATH
local MEDIA_PATH = MEDIA_PATH
or type ( AddonName ) == " table " and string.format ( " Interface \\ AddOns \\ Media \\ " )
or type ( AddonName ) == " table " and string.format ( " Interface \\ AddOns \\ Media \\ " )
or AddonName == " DiesalLibs " and string.format ( " Interface \\ AddOns \\ %s \\ %s \\ Media \\ " , AddonName , MAJOR )
or AddonName == " DiesalLibs " and string.format ( " Interface \\ AddOns \\ %s \\ %s \\ Media \\ " , AddonName , MAJOR )
@ -70,14 +72,14 @@ local function getMedia(mediaType, name)
end
end
local function newTexture ( )
local function newTexture ( )
local newTex ture = next ( ReleasedTextures )
local nt = next ( ReleasedTextures )
if not newTex ture then
if not nt then
newTex ture = TextureFrame : CreateTexture ( )
nt = TextureFrame : CreateTexture ( ) --[[@as Diesal.Style.Texture]]
else
else
newTex ture : Show ( )
nt : Show ( )
ReleasedTextures [ newTex ture ] = nil
ReleasedTextures [ nt ] = nil
end
end
return newTex ture
return nt
end
end
local function releaseTexture ( texture )
local function releaseTexture ( texture )
@ -114,8 +116,7 @@ local function GetBlizzColorValues(value)
if type ( value ) == " table " and # value >= 3 then
if type ( value ) == " table " and # value >= 3 then
return value [ 1 ] / 255 , value [ 2 ] / 255 , value [ 3 ] / 255
return value [ 1 ] / 255 , value [ 2 ] / 255 , value [ 3 ] / 255
elseif type ( value ) == " string " then
elseif type ( value ) == " string " then
return tonumber ( sub ( value , 1 , 2 ) , 16 ) / 255 , tonumber ( sub ( value , 3 , 4 ) , 16 ) / 255 ,
return tonumber ( sub ( value , 1 , 2 ) , 16 ) / 255 , tonumber ( sub ( value , 3 , 4 ) , 16 ) / 255 , tonumber ( sub ( value , 5 , 6 ) , 16 ) / 255
tonumber ( sub ( value , 5 , 6 ) , 16 ) / 255
end
end
end
end
@ -177,18 +178,13 @@ end
local function setColor ( texture , r , g , b , a )
local function setColor ( texture , r , g , b , a )
local status , err = pcall ( texture.SetColorTexture , texture , r , g , b , a )
local status , err = pcall ( texture.SetColorTexture , texture , r , g , b , a )
if not status then
if not status then
errorhandler (
errorhandler ( ' error in " ' .. ( texture.style . name or " texture " ) .. ' " ' .. texture.style . mode .. " or alpha setting " , r , g , b , a )
' error in " ' .. ( texture.style . name or " texture " ) .. ' " ' .. texture.style . mode .. " or alpha setting " , r , g ,
b ,
a )
end
end
end
end
local function setGradient ( texture , orientation , r1 , g1 , b1 , a1 , r2 , g2 , b2 , a2 )
local function setGradient ( texture , orientation , r1 , g1 , b1 , a1 , r2 , g2 , b2 , a2 )
local status , err = pcall ( texture.SetGradient , texture , orientation , CreateColor ( r1 , g1 , b1 , a1 ) ,
local status , err = pcall ( texture.SetGradient , texture , orientation , CreateColor ( r1 , g1 , b1 , a1 ) , CreateColor ( r2 , g2 , b2 , a2 ) )
CreateColor ( r2 , g2 , b2 , a2 ) )
if not status then
if not status then
errorhandler ( ' error in " ' ..
errorhandler ( ' error in " ' .. ( texture.style . name or " texture " ) .. ' " ' .. texture.style . mode .. " or alpha setting. " )
( texture.style . name or " texture " ) .. ' " ' .. texture.style . mode .. " or alpha setting. " )
end
end
end
end
-- ~~| Media |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~| Media |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -462,24 +458,18 @@ do -- | Set Colors |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Colors.UI_200 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.07 )
Colors.UI_200 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.07 )
-- level 3
-- level 3
Colors.UI_300 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.12 )
Colors.UI_300 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.12 )
Colors.UI_300_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.12 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation ,
Colors.UI_300_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.12 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.11 ) }
0.11 ) }
Colors.UI_350 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.15 )
Colors.UI_350 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.15 )
Colors.UI_350_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.17 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation ,
Colors.UI_350_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.17 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.14 ) }
0.14 ) }
-- level 4
-- level 4
Colors.UI_400 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.20 )
Colors.UI_400 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.20 )
Colors.UI_400_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.20 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation ,
Colors.UI_400_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.20 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.17 ) }
0.17 ) }
Colors.UI_450_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.24 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.20 ) }
Colors.UI_450_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.24 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation ,
0.20 ) }
-- level 5
-- level 5
Colors.UI_500 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.29 )
Colors.UI_500 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.29 )
Colors.UI_500_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.29 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation ,
Colors.UI_500_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.29 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.26 ) }
0.26 ) }
Colors.UI_600_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.35 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation ,
Colors.UI_600_GR = { HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.35 ) , HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.32 ) }
0.32 ) }
-- font Colors -35
-- font Colors -35
Colors.UI_F450 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.75 )
Colors.UI_F450 = HSL ( Colors.UI_Hue , Colors.UI_Saturation , 0.75 )
@ -4152,9 +4142,7 @@ do -- Set Material Icons
end
end
---@param iconName string
---@param iconName string
---@param iconType? "regular" | "outlined" | "round" | "sharp" | "twotone"
function DiesalStyle . MaterialIcon ( iconName )
function DiesalStyle . MaterialIcon ( iconName , iconType )
iconType = iconType or " regular "
if MaterialIcons.bytes [ iconName ] then
if MaterialIcons.bytes [ iconName ] then
return utf8 ( MaterialIcons.bytes [ iconName ] )
return utf8 ( MaterialIcons.bytes [ iconName ] )
end
end
@ -4200,10 +4188,8 @@ do -- Set Icons
---@param key string
---@param key string
---@param table table
---@param table table
local function checkType ( prefix , key , table )
local function checkType ( prefix , key , table )
assert ( type ( key ) == " string " ,
assert ( type ( key ) == " string " , string.format ( " key %d for %s not a string. " , prefixInfo [ prefix ] . count , prefixInfo [ prefix ] . prefix ) )
string.format ( " key %d for %s not a string. " , prefixInfo [ prefix ] . count , prefixInfo [ prefix ] . prefix ) )
assert ( type ( table ) == " table " , string.format ( " value %d for %s is not a table. " , prefixInfo [ prefix ] . count , prefixInfo [ prefix ] . prefix ) )
assert ( type ( table ) == " table " ,
string.format ( " value %d for %s is not a table. " , prefixInfo [ prefix ] . count , prefixInfo [ prefix ] . prefix ) )
end
end
for p1 , p1Table in pairs ( iconsToAdd ) do
for p1 , p1Table in pairs ( iconsToAdd ) do
@ -4217,21 +4203,15 @@ do -- Set Icons
local filePrefixes = string.format ( " %s%s%s " , p1 , p2 , p3 )
local filePrefixes = string.format ( " %s%s%s " , p1 , p2 , p3 )
Icons [ p1 ] [ p2 ] [ p3 ] = Icons [ p1 ] [ p2 ] [ p3 ] or { }
Icons [ p1 ] [ p2 ] [ p3 ] = Icons [ p1 ] [ p2 ] [ p3 ] or { }
for iconSize , fileDimTable in pairs ( p3Table ) do
for iconSize , fileDimTable in pairs ( p3Table ) do
assert ( type ( iconSize ) == " number " ,
assert ( type ( iconSize ) == " number " , string.format ( " icon size key %d for %s is not a number. " , prefixInfo [ 3 ] . iconSize , filePrefixes ) )
string.format ( " icon size key %d for %s is not a number. " , prefixInfo [ 3 ] . iconSize ,
filePrefixes ) )
filePrefixes = string.format ( " %s[%d] " , filePrefixes , iconSize )
filePrefixes = string.format ( " %s[%d] " , filePrefixes , iconSize )
Icons [ p1 ] [ p2 ] [ p3 ] [ iconSize ] = Icons [ p1 ] [ p2 ] [ p3 ] [ iconSize ] or { }
Icons [ p1 ] [ p2 ] [ p3 ] [ iconSize ] = Icons [ p1 ] [ p2 ] [ p3 ] [ iconSize ] or { }
for fileDimKey , iconColumns in pairs ( fileDimTable ) do
for fileDimKey , iconColumns in pairs ( fileDimTable ) do
assert ( type ( fileDimKey == " string " ) ,
assert ( type ( fileDimKey == " string " ) , string.format ( " file dimensions key for file %d in %s is not a string. " , prefixInfo [ 3 ] . file , filePrefixes ) )
string.format ( " file dimensions key for file %d in %s is not a string. " ,
prefixInfo [ 3 ] . file , filePrefixes ) )
local fileDims = strsplittable ( " x " , fileDimKey , 2 )
local fileDims = strsplittable ( " x " , fileDimKey , 2 )
assert ( type ( tonumber ( fileDims [ 1 ] ) ) == " number " ,
assert ( type ( tonumber ( fileDims [ 1 ] ) ) == " number " , string.format ( " could not obtain width from %s in %s " , fileDimKey , filePrefixes ) )
string.format ( " could not obtain width from %s in %s " , fileDimKey , filePrefixes ) )
assert ( type ( tonumber ( fileDims [ 2 ] ) ) == " number " , string.format ( " could not obtain height from %s in %s " , fileDimKey , filePrefixes ) )
assert ( type ( tonumber ( fileDims [ 2 ] ) ) == " number " ,
string.format ( " could not obtain height from %s in %s " , fileDimKey , filePrefixes ) )
Icons [ p1 ] [ p2 ] [ p3 ] [ iconSize ] [ fileDimKey ] = Icons [ p1 ] [ p2 ] [ p3 ] [ iconSize ] [ fileDimKey ] or { }
Icons [ p1 ] [ p2 ] [ p3 ] [ iconSize ] [ fileDimKey ] = Icons [ p1 ] [ p2 ] [ p3 ] [ iconSize ] [ fileDimKey ] or { }
filePrefixes = string.format ( " %s[%s] " , filePrefixes , fileDimKey )
filePrefixes = string.format ( " %s[%s] " , filePrefixes , fileDimKey )
@ -4247,18 +4227,14 @@ do -- Set Icons
local rowCount = 0
local rowCount = 0
for column , rows in pairs ( iconColumns ) do
for column , rows in pairs ( iconColumns ) do
columnCount = columnCount + 1
columnCount = columnCount + 1
assert ( type ( column ) == " number " ,
assert ( type ( column ) == " number " , string.format ( " column %d key in %s is not a number. " , columnCount , filePrefixes ) )
string.format ( " column %d key in %s is not a number. " , columnCount , filePrefixes ) )
assert ( type ( rows ) == " table " , string.format ( " column %d value in %s is not a table. " , columnCount , filePrefixes ) )
assert ( type ( rows ) == " table " ,
string.format ( " column %d value in %s is not a table. " , columnCount , filePrefixes ) )
local filePrefixesColumn = string.format ( " %s[%d] " , filePrefixes , column )
local filePrefixesColumn = string.format ( " %s[%d] " , filePrefixes , column )
iconsFileTable [ column ] = iconsFileTable [ column ] or { }
iconsFileTable [ column ] = iconsFileTable [ column ] or { }
for row , icon in pairs ( rows ) do
for row , icon in pairs ( rows ) do
rowCount = rowCount + 1
rowCount = rowCount + 1
assert ( type ( row ) == " number " ,
assert ( type ( row ) == " number " , string.format ( " row %d key in %s is not a number. " , rowCount , filePrefixesColumn ) )
string.format ( " row %d key in %s is not a number. " , rowCount , filePrefixesColumn ) )
assert ( type ( icon ) == " string " , string.format ( " row %d value in %s is not a string. " , rowCount , filePrefixesColumn ) )
assert ( type ( icon ) == " string " ,
string.format ( " row %d value in %s is not a string. " , rowCount , filePrefixesColumn ) )
local filePrefixesColumnRow = string.format ( " %s[%d] " , filePrefixesColumn , row )
local filePrefixesColumnRow = string.format ( " %s[%d] " , filePrefixesColumn , row )
local iconName = icon
local iconName = icon
@ -4301,8 +4277,7 @@ do -- Set Icons
---@param iconTable DiesalStyle.Icon
---@param iconTable DiesalStyle.Icon
local function CreateIconStyle ( iconTable )
local function CreateIconStyle ( iconTable )
local fileName = string.format ( " %s%s%s " , iconTable.file . prefix [ 1 ] , iconTable.file . prefix [ 2 ] ,
local fileName = string.format ( " %s%s%s " , iconTable.file . prefix [ 1 ] , iconTable.file . prefix [ 2 ] , iconTable.file . prefix [ 3 ] )
iconTable.file . prefix [ 3 ] )
local iconSize = iconTable.file . size.icon
local iconSize = iconTable.file . size.icon
fileName = fileName .. ( iconSize ~= 16 and iconSize or " " )
fileName = fileName .. ( iconSize ~= 16 and iconSize or " " )
@ -4677,10 +4652,8 @@ function DiesalStyle:StyleTexture(texture, style)
texture.style . alpha = formatAlpha ( style.alpha ) or texture.style . alpha or { 1 , 1 }
texture.style . alpha = formatAlpha ( style.alpha ) or texture.style . alpha or { 1 , 1 }
-- gradient
-- gradient
if texture.style . gradient then
if texture.style . gradient then
texture.style . gradient.orientation = style.gradient_orientation or texture.style . gradient.orientation or
texture.style . gradient.orientation = style.gradient_orientation or texture.style . gradient.orientation or DEFAULT_GRADIENT_ORIENTATION
DEFAULT_GRADIENT_ORIENTATION
texture.style . gradient.color = style.gradient_color or texture.style . gradient.color or { DEFAULT_COLOR , DEFAULT_COLOR }
texture.style . gradient.color = style.gradient_color or texture.style . gradient.color or
{ DEFAULT_COLOR , DEFAULT_COLOR }
end
end
-- image
-- image
if texture.style . image then
if texture.style . image then
@ -4716,8 +4689,7 @@ function DiesalStyle:StyleTexture(texture, style)
end
end
if style.debug then
if style.debug then
print ( texture : GetHeight ( ) , texture.style . position [ 1 ] , texture.style . position [ 2 ] , texture.style . position [ 3 ] ,
print ( texture : GetHeight ( ) , texture.style . position [ 1 ] , texture.style . position [ 2 ] , texture.style . position [ 3 ] , texture.style . position [ 4 ] )
texture.style . position [ 4 ] )
end
end
-- [1] Texture > [2] gradient > [3] color
-- [1] Texture > [2] gradient > [3] color
if texture.style . image then -- [1] Texture
if texture.style . image then -- [1] Texture
@ -4727,10 +4699,8 @@ function DiesalStyle:StyleTexture(texture, style)
setGradient ( texture , " HORIZONTAL " , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ) -- clear gradient
setGradient ( texture , " HORIZONTAL " , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ) -- clear gradient
texture : SetColorTexture ( 1 , 1 , 1 , 1 ) -- clear color
texture : SetColorTexture ( 1 , 1 , 1 , 1 ) -- clear color
-- apply settings
-- apply settings
texture : SetTexCoord ( texture.style . image.coords [ 1 ] , texture.style . image.coords [ 2 ] , texture.style . image.coords [ 3 ] ,
texture : SetTexCoord ( texture.style . image.coords [ 1 ] , texture.style . image.coords [ 2 ] , texture.style . image.coords [ 3 ] , texture.style . image.coords [ 4 ] )
texture.style . image.coords [ 4 ] )
texture : SetTexture ( texture.style . image.file , texture.style . image.tiling and texture.style . image.tiling [ 1 ] , texture.style . image.tiling and texture.style . image.tiling [ 2 ] )
texture : SetTexture ( texture.style . image.file , texture.style . image.tiling and texture.style . image.tiling [ 1 ] ,
texture.style . image.tiling and texture.style . image.tiling [ 2 ] )
texture : SetHorizTile ( texture.style . image.tiling [ 1 ] and true )
texture : SetHorizTile ( texture.style . image.tiling [ 1 ] and true )
texture : SetVertTile ( texture.style . image.tiling [ 2 ] and true )
texture : SetVertTile ( texture.style . image.tiling [ 2 ] and true )
local r , g , b = GetBlizzColorValues ( texture.style . image.color )
local r , g , b = GetBlizzColorValues ( texture.style . image.color )
@ -4742,13 +4712,9 @@ function DiesalStyle:StyleTexture(texture, style)
texture : SetTexture ( ) -- clear image
texture : SetTexture ( ) -- clear image
texture : SetColorTexture ( 1 , 1 , 1 , 1 ) -- clear color
texture : SetColorTexture ( 1 , 1 , 1 , 1 ) -- clear color
-- apply settings
-- apply settings
local r1 , g1 , b1 = GetBlizzColorValues ( texture.style . gradient.color
local r1 , g1 , b1 = GetBlizzColorValues ( texture.style . gradient.color [ texture.style . gradient.orientation == " HORIZONTAL " and 1 or 2 ] )
[ texture.style . gradient.orientation == " HORIZONTAL " and 1 or 2 ] )
local r2 , g2 , b2 = GetBlizzColorValues ( texture.style . gradient.color [ texture.style . gradient.orientation == " HORIZONTAL " and 2 or 1 ] )
local r2 , g2 , b2 = GetBlizzColorValues ( texture.style . gradient.color
local a1 , a2 = texture.style . alpha [ texture.style . gradient.orientation == " HORIZONTAL " and 1 or 2 ] , texture.style . alpha [ texture.style . gradient.orientation == " HORIZONTAL " and 2 or 1 ]
[ texture.style . gradient.orientation == " HORIZONTAL " and 2 or 1 ] )
local a1 , a2 =
texture.style . alpha [ texture.style . gradient.orientation == " HORIZONTAL " and 1 or 2 ] ,
texture.style . alpha [ texture.style . gradient.orientation == " HORIZONTAL " and 2 or 1 ]
setGradient ( texture , texture.style . gradient.orientation , r1 , g1 , b1 , a1 , r2 , g2 , b2 , a2 )
setGradient ( texture , texture.style . gradient.orientation , r1 , g1 , b1 , a1 , r2 , g2 , b2 , a2 )
elseif texture.style . color then -- [3] color
elseif texture.style . color then -- [3] color
-- set mode
-- set mode
@ -4794,8 +4760,7 @@ function DiesalStyle:StyleOutline(leftTexture, rightTexture, topTexture, bottomT
color = style.gradient [ 2 ] and style.gradient [ 3 ] and { style.gradient [ 2 ] , style.gradient [ 3 ] } ,
color = style.gradient [ 2 ] and style.gradient [ 3 ] and { style.gradient [ 2 ] , style.gradient [ 3 ] } ,
}
}
end
end
style.gradient_orientation = style.gradient_orientation and
style.gradient_orientation = style.gradient_orientation and style.gradient_orientation : upper ( ) --formatOrientation(style.gradient_orientation) -- fuck you
style.gradient_orientation : upper ( ) --formatOrientation(style.gradient_orientation) -- fuck you
if not texture.style . gradient and ( style.gradient_orientation or style.gradient_alpha or style.gradient_color ) then
if not texture.style . gradient and ( style.gradient_orientation or style.gradient_alpha or style.gradient_color ) then
texture.style . gradient = { }
texture.style . gradient = { }
end
end
@ -4808,10 +4773,8 @@ function DiesalStyle:StyleOutline(leftTexture, rightTexture, topTexture, bottomT
texture.style . alpha = formatAlpha ( style.alpha ) or texture.style . alpha or { 1 , 1 }
texture.style . alpha = formatAlpha ( style.alpha ) or texture.style . alpha or { 1 , 1 }
-- gradient
-- gradient
if texture.style . gradient then
if texture.style . gradient then
texture.style . gradient.orientation = style.gradient_orientation or texture.style . gradient.orientation or
texture.style . gradient.orientation = style.gradient_orientation or texture.style . gradient.orientation or DEFAULT_GRADIENT_ORIENTATION
DEFAULT_GRADIENT_ORIENTATION
texture.style . gradient.color = style.gradient_color or texture.style . gradient.color or { DEFAULT_COLOR , DEFAULT_COLOR }
texture.style . gradient.color = style.gradient_color or texture.style . gradient.color or
{ DEFAULT_COLOR , DEFAULT_COLOR }
end
end
-- | Apply Settings |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- | Apply Settings |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -4990,8 +4953,7 @@ end
---@param frame Frame
---@param frame Frame
---@param style Diesal.Style.ShadowStyle
---@param style Diesal.Style.ShadowStyle
function DiesalStyle : StyleShadow ( object , frame , style )
function DiesalStyle : StyleShadow ( object , frame , style )
object.shadow = object.shadow or
object.shadow = object.shadow or CreateFrame ( " Frame " , nil , frame , BackdropTemplateMixin and " BackdropTemplate " ) --CreateFrame("Frame",nil,frame)
CreateFrame ( " Frame " , nil , frame , BackdropTemplateMixin and " BackdropTemplate " ) --CreateFrame("Frame",nil,frame)
object.shadow : Show ( )
object.shadow : Show ( )
if not object.shadow . style or style.clear then
if not object.shadow . style or style.clear then
object.shadow . style = { }
object.shadow . style = { }
@ -4999,8 +4961,7 @@ function DiesalStyle:StyleShadow(object, frame, style)
local shadowStyle = object.shadow . style
local shadowStyle = object.shadow . style
-- ~~ Format New Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ Format New Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
local red , green , blue = DiesalTools.GetColor ( style.color )
local red , green , blue = DiesalTools.GetColor ( style.color )
local offset = style.offset and type ( style.offset ) == " number " and
local offset = style.offset and type ( style.offset ) == " number " and { style.offset , style.offset , style.offset , style.offset } or style.offset
{ style.offset , style.offset , style.offset , style.offset } or style.offset
-- Setting ~~~~~~~~~~~~~~~~~~~~~~~ New Setting ~~~~~~~~~~~~~~~ Old Setting ~~~~~~~~~~~~~~~~~ Default ~~~~~~~~~~~~~~~~~~
-- Setting ~~~~~~~~~~~~~~~~~~~~~~~ New Setting ~~~~~~~~~~~~~~~ Old Setting ~~~~~~~~~~~~~~~~~ Default ~~~~~~~~~~~~~~~~~~
shadowStyle.edgeFile = style.edgeFile or shadowStyle.edgeFile or getMedia ( " border " , " shadow " )
shadowStyle.edgeFile = style.edgeFile or shadowStyle.edgeFile or getMedia ( " border " , " shadow " )
shadowStyle.edgeSize = style.edgeSize or shadowStyle.edgeSize or 28
shadowStyle.edgeSize = style.edgeSize or shadowStyle.edgeSize or 28
@ -5146,7 +5107,7 @@ function DiesalStyle:UpdateObjectStyle(object, name, style)
local textures = { }
local textures = { }
for i = 1 , # OUTLINES do
for i = 1 , # OUTLINES do
local texture = object.textures [ name .. OUTLINES [ i ] ]
local texture = object.textures [ name .. OUTLINES [ i ] ]
if not texture then
if type ( texture ) == " nil " then
texture = newTexture ( )
texture = newTexture ( )
object.textures [ name .. OUTLINES [ i ] ] = texture
object.textures [ name .. OUTLINES [ i ] ] = texture
end
end
@ -5157,6 +5118,7 @@ function DiesalStyle:UpdateObjectStyle(object, name, style)
return
return
end
end
if styleType == " Shadow " then
if styleType == " Shadow " then
---@cast object Diesal.Style.ShadowObject
DiesalStyle : StyleShadow ( object , frame , style --[[ @as Diesal.Style.ShadowStyle ]] )
DiesalStyle : StyleShadow ( object , frame , style --[[ @as Diesal.Style.ShadowStyle ]] )
return
return
end
end