Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Shadow.ShadowColor3, ButtonStyle.Contained appearance adjustments, and US spelling for Colors #45

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Color.lua
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ local Color = {
White = rgb(255, 255, 255);
}

Color.Gray = Color.Grey
Color.BlueGray = Color.BlueGrey

function Color.toRGBString(c, a)
local r = c.r * 255 + 0.5
local g = c.g * 255 + 0.5
Expand Down
14 changes: 10 additions & 4 deletions RippleButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ local Shadow = Resources:LoadLibrary("Shadow")
local Rippler = Resources:LoadLibrary("Rippler")

-- Elevations
local RAISED_BASE_ELEVATION = 3
local RAISED_ELEVATION = 8
local RAISED_BASE_ELEVATION = 0
local RAISED_ELEVATION = 6
local HOVERED_ELEVATION = 4

Enumeration.ButtonStyle = {"Flat", "Outlined", "Contained"}

Expand All @@ -38,7 +39,7 @@ local StateOpacity = { -- TODO: Derive these values based on the PrimaryColor3's

[Enumeration.ButtonStyle.Contained.Value] = {
Hover = 0.12; --0.075;
Pressed = 0.3; -- 0.265;
Pressed = 0.16; -- 0.265;
};
}

Expand Down Expand Up @@ -122,7 +123,6 @@ return PseudoInstance:Register("RippleButton", {
end

local SecondaryColor3 = self.SecondaryColor3 or 0.5 < Luminosity and Color.Black or Color.White

self.Rippler.RippleColor3 = SecondaryColor3
self.TextLabel.TextColor3 = SecondaryColor3
self.Object.ImageColor3 = PrimaryColor3
Expand Down Expand Up @@ -293,6 +293,7 @@ return PseudoInstance:Register("RippleButton", {
-- self.Object.ImageColor3 = self.PrimaryColor3

self.Shadow = PseudoInstance.new("Shadow")
self.Shadow.ShadowColor3 = self.PrimaryColor3
self.Shadow.Parent = self.Object
self.Janitor:Add(self.Shadow, "Destroy", "Shadow")

Expand All @@ -319,6 +320,10 @@ return PseudoInstance:Register("RippleButton", {

PrimaryColor3 = Typer.AssignSignature(2, Typer.Color3, function(self, PrimaryColor3)
self:rawset("PrimaryColor3", PrimaryColor3)
if self.Style == Enumeration.ButtonStyle.Contained then
self.Shadow.ShadowColor3 = self.PrimaryColor3
end

self:Render()
end);

Expand Down Expand Up @@ -399,6 +404,7 @@ return PseudoInstance:Register("RippleButton", {
IsHovered = true

if self.Style == Enumeration.ButtonStyle.Contained then
self.Shadow:ChangeElevation(HOVERED_ELEVATION)
Tween(self.Object, "ImageColor3", self.PrimaryColor3:Lerp(self.Rippler.RippleColor3, self.OverlayOpacity), Enumeration.EasingFunction.Deceleration, 0.1, true)
else
Tween(self.Object, "ImageTransparency", 1 - self.OverlayOpacity, Enumeration.EasingFunction.Deceleration, 0.1, true)
Expand Down
11 changes: 11 additions & 0 deletions Shadow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,16 @@ return PseudoInstance:Register("Shadow", {

self:rawset("Elevation", Elevation)
end);

ShadowColor3 = Typer.AssignSignature(2, Typer.Color3, function(self, Color)
if self.ShadowColor3 == Color then return end

for Name, Data in next, ShadowData[self.Elevation.Value] do
self[Name].ImageColor3 = Color
end

self:rawset("ShadowColor3", Color)
end);

Parent = Typer.AssignSignature(2, Typer.OptionalInstanceWhichIsAGuiObject, function(self, Parent)
if Parent then
Expand Down Expand Up @@ -331,6 +341,7 @@ return PseudoInstance:Register("Shadow", {
end

self:rawset("Transparency", 0)
self:rawset("ShadowColor3", Color3.fromRGB(0,0,0))
self:rawset("Elevation", Enumeration.ShadowElevation.Elevation0)
self:superinit()
end;
Expand Down
112 changes: 0 additions & 112 deletions [DEPRECATED] Snackbar.md

This file was deleted.