263
Views
12
Comments
Solved
Change color of button on hover
Question

Change color of button on hover.

Have succeeded in changing the color of the icon with on hover but not with the button.

Someone who can assist with help

Is for mobile app

Please John.

2023-04-16 15-25-31
Krishnanand Pathak
Solution
UserImage.jpg
Alexandre Yip

Hi John, 

Add this class to css, and use in button

.btn-class:hover {

  background-color: yellow;

}

Change the color you want 

Hope that it helps you 

2023-04-16 15-25-31
Krishnanand Pathak

Hi @John Forsberg 

Add the below CSS to your screen & apply custom-btn class to your button:

 .custom-btn:hover {
  background-color: orange;
  border-color:  orange;  
}

 

Sharing the oml for reference.

Regards
Krishnanand Pathak

ButtonColor.oml
2023-01-03 11-55-04
Suchita Khandelwal

Hey!

You need to apply custom css for the button and the solution given by Krishnanand Pathak is correct.

2022-02-25 19-42-59
Srinivas K Singadi

Hello john 

Select the button you want to modify by clicking on it.

In the Properties tab, click on the "Style" section.

Click on the "+" button next to "Advanced" to add a new CSS class to the button.

In the "Class Name" field, give a name to the CSS class, for example "hover-color".

In the "Selector" field, type ".hover-color:hover".

In the "Properties" field, add the CSS properties you want to change when the button is hovered over. For example, to change the background color to blue, you can add:

css

Copy code

background-color: blue;

Save the CSS class by clicking on the "Ok" button.

Apply the CSS class to the button by adding the class name to the "Class" property in the "Style" section of the button's properties. For example, add "hover-color" to the "Class" property

UserImage.jpg
John Forsberg

Hi Srinivas Singadi

I am new to outsystem and am having a bit of trouble finding my way around the program. Can you get an example of what you describe.

John

2023-04-16 15-25-31
Krishnanand Pathak

Hi @John Forsberg ,


On test screen I added the below CSS class named custom-btn:

.custom-btn:hover {
  background-color: orange;
  border-color:  orange;  
}

Then applied the class over the button named Hover Me.

Sharing the oml again for better understanding.

Regards
Krishnanand Pathak


ButtonColor(1).oml
UserImage.jpg
John Forsberg

Thanks for the help but I have tried your example.

But I have several buttons with different colors.

And if I change the color with your solution on the button style, only the Border around the button will change color.


John

2023-04-16 15-25-31
Krishnanand Pathak

Please check the below demo link  :
https://personal-qmzjggmd.outsystemscloud.com/PreviewInDevices/?IsMobilePreview=True&DeviceName=Smartphone&URL=/ButtonColor/Test?_ts=638135305713350947
There are three button with different background-color applied when hover.

All button will change the background color not only border color.
And for different colors for different button use different class like below

 .custom-btn-orange:hover {
  background-color: orange;
  border-color:  orange;  
}

 .custom-btn-green:hover {
  background-color: green;
  border-color:  green;  
}

 .custom-btn-blue:hover {
  background-color: blue;
  border-color:  blue;  
}

Updated oml is attached for reference

Hope this will help

Updated_Button_Bg.oml
UserImage.jpg
John Forsberg

Thanks will look into it

John

UserImage.jpg
John Forsberg

We misunderstand each other. The color of the button in your example way by Theme Editor. and when you hover on button you get the color that controls

  .Custom-Btn-orange: Hover {

   Background-Color: Orange;

   Border-Color: Orange;


But I have buttons that have different colors basically.

And then at Hover, the color should be changed.


As it is now in your example, it is a color on the button before Hover.

I want to be able to have individual color on the buttons before hover


John

2023-04-16 15-25-31
Krishnanand Pathak
Solution
Updated_Button_Bg.oml
UserImage.jpg
John Forsberg


Works Perfect as I want.

Once again thanks for the help

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.