impr: Added small moon icon to the welcome screen of nightly builds

This commit is contained in:
WerWolv 2024-06-05 22:23:43 +02:00
parent c217b1b100
commit 348fe27a3c
3 changed files with 38 additions and 5 deletions

View file

@ -805,7 +805,7 @@ namespace hex {
#endif
}
bool isNightly() {
bool isNightlyBuild() {
return getImHexVersion(false).ends_with("WIP");
}

View file

@ -0,0 +1,21 @@
<svg xmlns="http://www.w3.org/2000/svg" width="105" height="105" fill="none" viewBox="0 0 105 105">
<g filter="url(#a)">
<path fill="url(#b)" fill-rule="evenodd" d="M61.16 2.892c1.863 0 2.528 2.4 1.131 3.633-13.186 11.627-18.25 30.749-11.23 47.944 7.836 19.2 28.114 29.576 47.72 25.615 1.825-.368 3.335 1.612 2.209 3.095-5.23 6.89-12.319 12.513-20.908 16.02C54.515 109.632 25.33 97.366 14.895 71.8 4.459 46.234 16.725 17.048 42.292 6.613a49.856 49.856 0 0 1 18.868-3.72Z" clip-rule="evenodd"/>
</g>
<defs>
<linearGradient id="b" x1="20.5" x2="100.5" y1="-10.5" y2="131" gradientUnits="userSpaceOnUse">
<stop stop-color="#C22EDF"/>
<stop offset="1" stop-color="#681A80"/>
</linearGradient>
<filter id="a" width="90.204" height="104.026" x="11.174" y="2.892" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
<feOffset dy="4"/>
<feGaussianBlur stdDeviation="2"/>
<feComposite in2="hardAlpha" k2="-1" k3="1" operator="arithmetic"/>
<feColorMatrix values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.27 0"/>
<feBlend in2="shape" result="effect1_innerShadow_3_42"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -37,7 +37,7 @@
namespace hex::plugin::builtin {
namespace {
ImGuiExt::Texture s_bannerTexture, s_backdropTexture, s_infoBannerTexture;
ImGuiExt::Texture s_bannerTexture, s_nightlyTexture, s_backdropTexture, s_infoBannerTexture;
std::string s_tipOfTheDay;
@ -183,6 +183,17 @@ namespace hex::plugin::builtin {
ImGui::TableNextColumn();
ImGui::Image(s_bannerTexture, s_bannerTexture.getSize());
if (ImHexApi::System::isNightlyBuild()) {
auto cursor = ImGui::GetCursorPos();
ImGui::SameLine(0);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 15_scaled);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5_scaled);
ImGui::Image(s_nightlyTexture, s_nightlyTexture.getSize());
ImGui::SetCursorPos(cursor);
}
ImGui::NewLine();
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_PopupBg));
@ -504,12 +515,13 @@ namespace hex::plugin::builtin {
return ImGuiExt::Texture::fromImage(romfs::get(path).span(), ImGuiExt::Texture::Filter::Nearest);
};
auto changeTextureSvg = [&](const std::string &path) {
return ImGuiExt::Texture::fromSVG(romfs::get(path).span(), 300_scaled, 0, ImGuiExt::Texture::Filter::Linear);
auto changeTextureSvg = [&](const std::string &path, float width) {
return ImGuiExt::Texture::fromSVG(romfs::get(path).span(), width, 0, ImGuiExt::Texture::Filter::Linear);
};
ThemeManager::changeTheme(theme);
s_bannerTexture = changeTextureSvg(hex::format("assets/{}/banner.svg", ThemeManager::getImageTheme()));
s_bannerTexture = changeTextureSvg(hex::format("assets/{}/banner.svg", ThemeManager::getImageTheme()), 300_scaled);
s_nightlyTexture = changeTextureSvg(hex::format("assets/{}/nightly.svg", "common"), 35_scaled);
s_backdropTexture = changeTexture(hex::format("assets/{}/backdrop.png", ThemeManager::getImageTheme()));
if (!s_bannerTexture.isValid()) {