add gs
This commit is contained in:
+162
@@ -0,0 +1,162 @@
|
||||
local ThemesRoot = script.Parent
|
||||
local StylesRoot = ThemesRoot.Parent
|
||||
local Colors = require(StylesRoot.Colors)
|
||||
|
||||
local theme = {
|
||||
BackgroundDefault = {
|
||||
Color = Colors.Slate,
|
||||
Transparency = 0,
|
||||
},
|
||||
BackgroundContrast = {
|
||||
Color = Colors.Carbon,
|
||||
Transparency = 0,
|
||||
},
|
||||
BackgroundMuted = {
|
||||
Color = Colors.Obsidian,
|
||||
Transparency = 0,
|
||||
},
|
||||
BackgroundUIDefault = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
BackgroundUIContrast = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.3, -- Alpha 0.7
|
||||
},
|
||||
BackgroundOnHover = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.9, -- Alpha 0.1
|
||||
},
|
||||
BackgroundOnPress = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.7, -- Alpha 0.3
|
||||
},
|
||||
|
||||
UIDefault = {
|
||||
Color = Colors.Graphite,
|
||||
Transparency = 0,
|
||||
},
|
||||
UIMuted = {
|
||||
Color = Colors.Obsidian,
|
||||
Transparency = 0.2, -- Alpha 0.8
|
||||
},
|
||||
UIEmphasis = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.7, -- Alpha 0.3
|
||||
},
|
||||
|
||||
ContextualPrimaryDefault = {
|
||||
Color = Colors.Green,
|
||||
Transparency = 0,
|
||||
},
|
||||
ContextualPrimaryOnHover = {
|
||||
Color = Colors.Green,
|
||||
Transparency = 0,
|
||||
},
|
||||
ContextualPrimaryContent = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
|
||||
SystemPrimaryDefault = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
SystemPrimaryOnHover = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
SystemPrimaryContent = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
|
||||
SecondaryDefault = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.3, -- 0.7 Alpha
|
||||
},
|
||||
SecondaryOnHover = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
SecondaryContent = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.3, -- 0.7 Alpha
|
||||
},
|
||||
|
||||
IconDefault = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.3, -- 0.7 alpha
|
||||
},
|
||||
IconEmphasis = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
IconOnHover = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
|
||||
TextEmphasis = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
TextDefault = {
|
||||
Color = Colors.Pumice,
|
||||
Transparency = 0,
|
||||
},
|
||||
TextMuted = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.3, -- 0.7 Alpha
|
||||
},
|
||||
|
||||
Divider = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.8, -- 0.2 Alpha
|
||||
},
|
||||
Overlay = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.5, -- 0.5 Alpha
|
||||
},
|
||||
DropShadow = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0,
|
||||
},
|
||||
NavigationBar = {
|
||||
Color = Colors.Carbon,
|
||||
Transparency = 0,
|
||||
},
|
||||
PlaceHolder = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0.5, -- 0.5 Alpha
|
||||
},
|
||||
|
||||
OnlineStatus = {
|
||||
Color = Colors.Green,
|
||||
Transparency = 0,
|
||||
},
|
||||
OfflineStatus = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.3, -- 0.7 Alpha
|
||||
},
|
||||
|
||||
Success = {
|
||||
Color = Colors.Green,
|
||||
Transparency = 0,
|
||||
},
|
||||
Alert = {
|
||||
Color = Colors.Red,
|
||||
Transparency = 0,
|
||||
},
|
||||
|
||||
Badge = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
BadgeContent = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
}
|
||||
|
||||
return theme
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
return function()
|
||||
it("should be a valid theme palette.", function()
|
||||
local CorePackages = game:GetService("CorePackages")
|
||||
local UIBlox = require(CorePackages.UIBlox)
|
||||
local validateTheme = UIBlox.Style.Validator.validateTheme
|
||||
local DarkTheme = require(script.Parent.DarkTheme)
|
||||
assert(validateTheme(DarkTheme))
|
||||
end)
|
||||
end
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
local ThemesRoot = script.Parent
|
||||
local StylesRoot = ThemesRoot.Parent
|
||||
local LuaAppRoot = StylesRoot.Parent
|
||||
|
||||
local Colors = require(StylesRoot.Colors)
|
||||
local GetFFlagLuaAppFixLightTheme = require(LuaAppRoot.Flags.GetFFlagLuaAppFixLightTheme)
|
||||
|
||||
local theme = {
|
||||
BackgroundDefault = {
|
||||
Color = Colors.Alabaster,
|
||||
Transparency = 0,
|
||||
},
|
||||
BackgroundContrast = {
|
||||
Color = Colors.Ash,
|
||||
Transparency = 0,
|
||||
},
|
||||
BackgroundMuted = {
|
||||
Color = Colors.Chalk,
|
||||
Transparency = 0,
|
||||
},
|
||||
BackgroundUIDefault = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
BackgroundUIContrast = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.1, -- Alpha 0.9
|
||||
},
|
||||
BackgroundOnHover = GetFFlagLuaAppFixLightTheme() and {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.9, -- Alpha 0.1
|
||||
} or {
|
||||
Color = Colors.White,
|
||||
Transparency = 0.7, -- Alpha 0.3
|
||||
},
|
||||
BackgroundOnPress = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.9, -- Alpha 0.1
|
||||
},
|
||||
|
||||
UIDefault = {
|
||||
Color = Colors.Pumice,
|
||||
Transparency = 0,
|
||||
},
|
||||
UIMuted = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.9, -- Alpha 0.1
|
||||
},
|
||||
UIEmphasis = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.7, -- Alpha 0.3
|
||||
},
|
||||
|
||||
ContextualPrimaryDefault = {
|
||||
Color = Colors.Green,
|
||||
Transparency = 0,
|
||||
},
|
||||
ContextualPrimaryOnHover = {
|
||||
Color = Colors.Green,
|
||||
Transparency = 0,
|
||||
},
|
||||
ContextualPrimaryContent = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
|
||||
SystemPrimaryDefault = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
SystemPrimaryOnHover = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
SystemPrimaryContent = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
|
||||
SecondaryDefault = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.5, -- 0.5 Alpha
|
||||
},
|
||||
SecondaryOnHover = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
SecondaryContent = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.5, -- 0.5 Alpha
|
||||
},
|
||||
|
||||
IconDefault = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.4, -- 0.6 alpha
|
||||
},
|
||||
IconEmphasis = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
IconOnHover = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
|
||||
TextEmphasis = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
TextDefault = {
|
||||
Color = Colors.Smoke,
|
||||
Transparency = 0,
|
||||
},
|
||||
TextMuted = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.4, -- 0.6 Alpha
|
||||
},
|
||||
|
||||
Divider = {
|
||||
Color = Colors.Pumice,
|
||||
Transparency = 0,
|
||||
},
|
||||
Overlay = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.7, -- 0.3 Alpha
|
||||
},
|
||||
DropShadow = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0,
|
||||
},
|
||||
NavigationBar = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
PlaceHolder = {
|
||||
Color = Colors.Chalk,
|
||||
Transparency = 0.3, -- 0.7 Alpha
|
||||
},
|
||||
|
||||
OnlineStatus = {
|
||||
Color = Colors.Green,
|
||||
Transparency = 0,
|
||||
},
|
||||
OfflineStatus = {
|
||||
Color = Colors.Black,
|
||||
Transparency = 0.5, -- 0.5 Alpha
|
||||
},
|
||||
|
||||
Success = {
|
||||
Color = Colors.Green,
|
||||
Transparency = 0,
|
||||
},
|
||||
Alert = {
|
||||
Color = Colors.Red,
|
||||
Transparency = 0,
|
||||
},
|
||||
|
||||
Badge = {
|
||||
Color = Colors.Flint,
|
||||
Transparency = 0,
|
||||
},
|
||||
BadgeContent = {
|
||||
Color = Colors.White,
|
||||
Transparency = 0,
|
||||
},
|
||||
}
|
||||
|
||||
return theme
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
return function()
|
||||
it("should be a valid theme palette.", function()
|
||||
local CorePackages = game:GetService("CorePackages")
|
||||
local UIBlox = require(CorePackages.UIBlox)
|
||||
local validateTheme = UIBlox.Style.Validator.validateTheme
|
||||
local LightTheme = require(script.Parent.DarkTheme)
|
||||
assert(validateTheme(LightTheme))
|
||||
end)
|
||||
end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
local CorePackages = game:GetService("CorePackages")
|
||||
local ArgCheck = require(CorePackages.ArgCheck)
|
||||
local Logging = require(CorePackages.Logging)
|
||||
local UIBlox = require(CorePackages.UIBlox)
|
||||
local validateTheme = UIBlox.Style.Validator.validateTheme
|
||||
|
||||
return function (themeName, defaultTheme, themeMap)
|
||||
local mappedTheme
|
||||
if themeName ~= nil and #themeName > 0 then
|
||||
mappedTheme = themeMap[string.lower(themeName)]
|
||||
end
|
||||
|
||||
if mappedTheme == nil then
|
||||
mappedTheme = themeMap[defaultTheme]
|
||||
Logging.warn(string.format("Unrecognized theme name: `%s`", tostring(themeName)))
|
||||
end
|
||||
ArgCheck.assert(validateTheme(mappedTheme))
|
||||
return mappedTheme
|
||||
end
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
return function()
|
||||
local getThemeFromName = require(script.Parent.getThemeFromName)
|
||||
local Constants = require(script.Parent.Parent.Constants)
|
||||
it("should be able to get a theme palette without errors", function()
|
||||
local themeMap = {
|
||||
[Constants.ThemeName.Dark] = require(script.Parent.DarkTheme),
|
||||
}
|
||||
local themeTable = getThemeFromName(Constants.ThemeName.Dark, Constants.ThemeName.Dark,themeMap)
|
||||
expect(themeTable).to.be.a("table")
|
||||
end)
|
||||
|
||||
it("should be able to get a theme palette using default without errors", function()
|
||||
local themeMap = {
|
||||
[Constants.ThemeName.Dark] = require(script.Parent.DarkTheme),
|
||||
}
|
||||
local themeTable = getThemeFromName("classic", Constants.ThemeName.Dark, themeMap)
|
||||
expect(themeTable).to.be.a("table")
|
||||
end)
|
||||
|
||||
it("should throw with invalid theme palette", function()
|
||||
expect(function()
|
||||
local themeMap = {
|
||||
[Constants.ThemeName.Dark] = {
|
||||
Background = {
|
||||
Color = Color3.fromRGB(0, 0, 0),
|
||||
Transparency = 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
getThemeFromName(Constants.ThemeName.Dark, Constants.ThemeName.Dark, themeMap)
|
||||
end).to.throw()
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user