Changing the Color of the Search Box Icon Button in Flarum

4,317 0

This tutorial is completely unnecessary; I just think it looks better after changing the color. After all, everyone has different tastes, and some people may like the original color, but I’ll record it anyway—just in case someone else, like me, wants to change it to a different color. Let’s start with an image.

Process

First, find the class name of the search box by inspecting the element with F12.

Get the .Search-input:before class name and open

Less
/vendor/flarum/core/less/lib/Search.less

Modify it according to the image below. The left side shows the modified version, and the right side shows the original.

Change it to the following CSS:

CSS
background: #2aaaff;
color: #fff;
border-radius: 4px 0 0 4px;
padding-left: 40px;
padding-right: 10px;

Make Background match the website theme color.

CSS
background: #2aaaff; 
改成
background: @primary-color;

Comments

(0)

No comments yet. Start the conversation.

Leave a comment

© 2026 Carefree. All rights reserved.

Carefree is a personal site about technology and everyday life, documenting web development, backend, and DevOps practices, plus software tools, digital experiences, and thoughts beyond code.