Skip to content

Conversation

DetectiveBaldi
Copy link
Contributor

@DetectiveBaldi DetectiveBaldi commented Sep 21, 2025

Recently I was working on a search engine using the new input text component, and modified the selection color to the value seen in Chrome browsers. I realized though that this color contrasted very poorly at 100% alpha, and from what I can tell there is no way to change it currently.

Simple test case:

package;

import flixel.FlxSprite;
import flixel.util.FlxColor;
import flixel.FlxG;
import flixel.text.FlxInputText;
import flixel.FlxState;

class PlayState extends FlxState
{
	override public function create()
	{
		super.create();

		camera.bgColor = FlxColor.WHITE;

		var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 44, FlxColor.RED);
		bg.screenCenter();
		add(bg);

		var text:FlxInputText = new FlxInputText(0.0, 0.0, FlxG.width, "", 32, FlxColor.BLACK, FlxColor.TRANSPARENT);
		text.color = FlxColor.WHITE;
		text.text = "Hello!";
		// 0.3 alpha
		text.selectionColor = 0x4D0074FF;
		text.screenCenter();
		add(text);
	}
}

Before:
image
After:
image
Although color alpha isn't typically honored with FlxSprites (not really sure why this is the case either), I think it would make much more sense to make color alpha valid here instead of creating a whole new selectionAlpha field or something along those lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant