Skip to content
⌘ NSIS Forum Archive

Label background colour on README and INSTFILES pages

6 posts

Rippel#

Label background colour on README and INSTFILES pages

Hi, is it possible to change the background of the text labels on MUI_PAGE_README and MUI_PAGE_INSTFILES?

I have already set these, but this leaves the background of the text labels as Windows grey...

 !define MUI_LICENSEPAGE_BGCOLOR 0xFFFFFF
!define MUI_INSTFILESPAGE_COLORS "0x505050 0xFFFFFF"
!define MUI_BGCOLOR 0xFFFFFF
JasonFriday13#
As far as I can tell the label colours aren't touched by MUI2. The default MUI2 colours are either white or /windows (which is usually white). So your code is really only changing the InstFiles text colour to grey. What are you trying to do?
Anders#
What is MUI_PAGE_README?

Like Jason said, most controls use the normal Windows colors. They can be changed with SetCtlColors.
Rippel#edited
Hi, thanks for the replies.

MUI_PAGE_README is a derivative of the MUI_LICENSEPAGE



I'm trying to set the background of all my pages to white, which I'm able to do with my custom pages easily. However, the README/LICENSE page and install page are using the normal Windows colors on labels, so they're showing as black text on a grey background.

The install details box is showing as grey text on a white background - which is what I want.

I guessed I could use SetCtlColors, but how do I get an ID of the label controls on those pages, and where would I put the code to do this?

ie. On the readme page below, the background of the labels "Please review..." and "Click on scrollbar..." are still using /windows colours. On the instfiles page, the "Create shortcut..." label is using the /windows colours. I want to make these use a white background.






Thanks for any clues!
JasonFriday13#
Oh OK, I had a feeling that's what you were doing. So you will want something like this:

Name "Colour Test"
OutFile "Colour Test.exe"

RequestExecutionLevel User
ShowInstDetails Show

!include "MUI2.nsh"

!define MUI_INSTFILESPAGE_COLORS "0x505050 0xFFFFFF"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW "InstShow"
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

Function InstShow
SetCtlColors $HWNDPARENT 0 0xFFFFFF ; parent background white, black text
FindWindow $0 "#32770" "" $HWNDPARENT ; get the inner dialog
SetCtlColors $0 0 transparent ; make the background transparent, black text
GetDlgItem $1 $0 1006 ; get an item handle (detail text)
SetCtlColors $1 0 transparent ; make that item's background transparent, black text
FunctionEnd

Section
SectionEnd
Bear in mind this is just one page, you will have to add custom functions for each of your pages to change the colours manually.

Using 'transparent' means if you wanted to change the background colour, you don't have to repaint everything in the new colour since all the backgrounds are transparent. Try it with this example.
Rippel#
Fantastic, that's exactly what I needed and it works a treat. The missing link was the MUI_PAGE_CUSTOMFUNCTION_SHOW function.

Thanks loads! 🙂