Jump to content

QuickApp changing text size and color


Recommended Posts

I am looking for ways to change the fontsize and/or color of a QA panel. Seems to me that it should be done trough updateView, but I can only find the "text" and "value" properties documented (or rather, mentioned in this forum)

Is there a way to change the appearance of a QA?

Link to post
Share on other sites

Hi @josjg , I'm changing the text colors with html formating...

afbeelding.png.f3f3113f70aba31d7887d5eb2ce89bde.png

 

-- color definitions
local crc,okc,erc,ekc,evc,xec,cnc,xcc="#03ff0e","#00ac08","#ff0303","#FFFACD","#FFA07A","#FF69B4","#1639ff","#B0E0E6","#7B68EE","#FFE4E1"

--function used to format
function span(col,str)return fmt("<b><font color="..col..">"..str.."</font></b>")end

-- General usage
self:updateView("lblTitle","text",span(crc,"Your text to be displayed"))

--Upper label with bigger font
self:updateView("lblTitle","text",string.format("<span class=\"section-title\"><b><font color=%s>📍 WeatherFlow station %s [%s]</font></b></span>",cnc,d.station_name,d.station_id))

afbeelding.png.b7fd33adda6e9781fa75ab811e8c8134.png

 

 

Enjoy coding :-D

 

P.S. This solution is not working in the app, only in BUI.

Edited by Bodyart
Link to post
Share on other sites

Thanks a lot @Bodyart I've used self:updateView with a label and passing inline CSS, and it works.

Next thing I'm looking for is to change the color of a button in my QA. I've noticed the QA having a "viewXml" property set to true. Could that be the way in? Or should I look for [device].properties.viewLayout?

Link to post
Share on other sites

Hello. I create a quick app  multisensor that displays a number  in dashboard of HC3 by using the updateProperty("value" ,number) . 

Is there a way to display a text instead of a number ? I used label but I have to click on quick app icon to see the label text but I want this text to be displayed on dashboard.

Link to post
Share on other sites

Unit for the text behind the number and log for text under value / unit. 
 

 

Edited by SmartHomeEddy
  • Thanks 1
Link to post
Share on other sites

Great! Thank you @SmartHomeEddy ! I can now appear the Unit of a number but Is there any way to display only the text. I want to create somthing like information box in dashboard. If this is not possible with this type of QA , is there an appropriate type to do this?  Thanks a lot!!

 

P.S. This was very simple in VDs on HCL and HC2 by creating a Label and check the field "Main" and "Favorite" 

Edited by Prokopis Bor
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...