Why is my FLinearColor::Blue showing up as black?

Greets,

I’m trying to make a slate ProgressBar blue with FLinearColor::Blue, like this: https://github.com/icannotfly/onward/blob/82c4075a5ed9686efc80cb629c3aaeef5ef99a41/Source/onward/Private/hud/DebugBarsWidget.cpp#L141

but it always comes out black, like this: http://i.imgur.com/zVyTczN.png

Even when I try FLinearColor(0,0,1), it still comes out black. What’s going on here?

Hey icannotfly-

What happens if you use a color other than blue? Seeing as Green and Red appear to generate the correct color, can you try replacing blue with one of these? Also, if you replace Red with blue, does it start showing up as black? If you are able to provide an example of this behavior (sample project) it could help in investigating the issue.

Hey icannotfly-

After further testing, it appears that the Blue is being ignored for FLinearColor values inside slate. This has been reported here Unreal Engine Issues and Bug Tracker (UE-40734) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers

Colors other than blue work just fine, unless they rely on the blue channel: FLinearColor::White shows up as orange because blue is missing.

I have been able to reproduce the issue in a fresh 4.14.3 project which is available for download here: https://drive.google.com/file/d/0B1bm9118djhaVXgxaEtyRVJ2aDQ/view?usp=sharing
The project includes instructions to reproduce the issue.
Source for the widget cpp is available here: http://pastebin.ca/3758051

Hi,

This is not a bug and working as intended. This is caused by the FillImage of the default SProgressBar (it isn’t being overridden in the code example above);

	// SProgressBar defaults...
	{
		Style->Set( "ProgressBar", FProgressBarStyle()
			.SetBackgroundImage( BOX_BRUSH( "Common/ProgressBar_Background", FMargin(5.f/12.f) ) )
			.SetFillImage( BOX_BRUSH( "Common/ProgressBar_Fill", FMargin(5.f/12.f), FLinearColor( 1.0f, 0.22f, 0.0f )  ) )
			.SetMarqueeImage( IMAGE_BRUSH( "Common/ProgressBar_Marquee", FVector2D(20,12), FLinearColor::White, ESlateBrushTileType::Horizontal ) )
			);
	}

In the OnPaint function of SProgressBar it then multiplies all the colors together and because the default fill image color has a 0 blue value it gets ignored.

	const FLinearColor FillColorAndOpacitySRGB(InWidgetStyle.GetColorAndOpacityTint() * FillColorAndOpacity.Get().GetColor(InWidgetStyle) * CurrentFillImage->GetTint(InWidgetStyle));

To resolve this issue, simply create a new FSlateBrush and override the fill image;

 SNew(SProgressBar)
.Percent(0.68)
.FillImage(&NewFillBrush)

Hope this helps. Cheers,