Skip to content

Commit

Permalink
Align background classes with Bootstrap 5.3 (#1015)
Browse files Browse the repository at this point in the history
(cherry picked from commit 84aa84e)
  • Loading branch information
vrozkovec authored and martin-g committed Dec 11, 2023
1 parent 878d23a commit fac8533
Showing 1 changed file with 127 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,29 @@ public class BackgroundColorBehavior extends BootstrapBaseBehavior {

/**
* Enumeration of all possible background colors.
* https://getbootstrap.com/docs/5.3/utilities/background/
*/
public enum Color implements ICssClassNameProvider {
Primary("primary"),
Primary_subtle("primary-subtle"),
Secondary("secondary"),
Secondary_subtle("secondary-subtle"),
Success("success"),
Success_subtle("success-subtle"),
Danger("danger"),
Danger_subtle("danger-subtle"),
Warning("warning"),
Warning_subtle("warning-subtle"),
Info("info"),
Success("success"),
Info_subtle("info-subtle"),
Light("light"),
Light_subtle("light-subtle"),
Dark("dark"),
Dark_subtle("dark-subtle"),
Body_secondary("body-secondary"),
Body_tertiary("body-tertiary"),
Body("body"),
Black("black"),
White("white"),
Transparent("transparent");

Expand Down Expand Up @@ -110,7 +123,6 @@ public Color getColor() {
public IModel<Color> getColorModel() {
return colorModel;
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Primary} to component
*
Expand All @@ -120,6 +132,15 @@ public static BackgroundColorBehavior primary() {
return new BackgroundColorBehavior(Color.Primary);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Primary_subtle} to component
*
* @return behavior that adds primary subtle background color to component
*/
public static BackgroundColorBehavior primarySubtle() {
return new BackgroundColorBehavior(Color.Primary_subtle);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Secondary} to component
*
Expand All @@ -129,6 +150,33 @@ public static BackgroundColorBehavior secondary() {
return new BackgroundColorBehavior(Color.Secondary);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Secondary_subtle} to component
*
* @return behavior that adds secondary subtle background color to component
*/
public static BackgroundColorBehavior secondarySubtle() {
return new BackgroundColorBehavior(Color.Secondary_subtle);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Success} to component
*
* @return behavior that adds success background color to component
*/
public static BackgroundColorBehavior success() {
return new BackgroundColorBehavior(Color.Success);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Success_subtle} to component
*
* @return behavior that adds success subtle background color to component
*/
public static BackgroundColorBehavior successSubtle() {
return new BackgroundColorBehavior(Color.Success_subtle);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Danger} to component
*
Expand All @@ -138,6 +186,15 @@ public static BackgroundColorBehavior danger() {
return new BackgroundColorBehavior(Color.Danger);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Danger_subtle} to component
*
* @return behavior that adds danger subtle background color to component
*/
public static BackgroundColorBehavior dangerSubtle() {
return new BackgroundColorBehavior(Color.Danger_subtle);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Warning} to component
*
Expand All @@ -148,12 +205,12 @@ public static BackgroundColorBehavior warning() {
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Success} to component
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Warning_subtle} to component
*
* @return behavior that adds success background color to component
* @return behavior that adds warning subtle background color to component
*/
public static BackgroundColorBehavior success() {
return new BackgroundColorBehavior(Color.Success);
public static BackgroundColorBehavior warningSubtle() {
return new BackgroundColorBehavior(Color.Warning_subtle);
}

/**
Expand All @@ -165,6 +222,15 @@ public static BackgroundColorBehavior info() {
return new BackgroundColorBehavior(Color.Info);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Info_subtle} to component
*
* @return behavior that adds info subtle background color to component
*/
public static BackgroundColorBehavior infoSubtle() {
return new BackgroundColorBehavior(Color.Info_subtle);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Light} to component
*
Expand All @@ -174,6 +240,15 @@ public static BackgroundColorBehavior light() {
return new BackgroundColorBehavior(Color.Light);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Light_subtle} to component
*
* @return behavior that adds light subtle background color to component
*/
public static BackgroundColorBehavior lightSubtle() {
return new BackgroundColorBehavior(Color.Light_subtle);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Dark} to component
*
Expand All @@ -183,6 +258,51 @@ public static BackgroundColorBehavior dark() {
return new BackgroundColorBehavior(Color.Dark);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Dark_subtle} to component
*
* @return behavior that adds dark subtle background color to component
*/
public static BackgroundColorBehavior darkSubtle() {
return new BackgroundColorBehavior(Color.Dark_subtle);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Body_secondary} to component
*
* @return behavior that adds body secondary background color to component
*/
public static BackgroundColorBehavior bodySecondary() {
return new BackgroundColorBehavior(Color.Body_secondary);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Body_tertiary} to component
*
* @return behavior that adds body tertiary background color to component
*/
public static BackgroundColorBehavior bodyTertiary() {
return new BackgroundColorBehavior(Color.Body_tertiary);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Body} to component
*
* @return behavior that adds body background color to component
*/
public static BackgroundColorBehavior body() {
return new BackgroundColorBehavior(Color.Body);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#Black} to component
*
* @return behavior that adds black background color to component
*/
public static BackgroundColorBehavior black() {
return new BackgroundColorBehavior(Color.Black);
}

/**
* Constructs new behavior that adds {@link BackgroundColorBehavior.Color#White} to component
*
Expand All @@ -200,4 +320,5 @@ public static BackgroundColorBehavior white() {
public static BackgroundColorBehavior transparent() {
return new BackgroundColorBehavior(Color.Transparent);
}

}

0 comments on commit fac8533

Please sign in to comment.