use new awesome ColorProvider utility

This commit is contained in:
HJfod 2024-02-28 00:27:43 +02:00
parent b356a7670a
commit 54ac66ef7c
2 changed files with 11 additions and 5 deletions

View file

@ -1,5 +1,6 @@
#include "ModList.hpp" #include "ModList.hpp"
#include <Geode/ui/TextInput.hpp> #include <Geode/ui/TextInput.hpp>
#include <Geode/utils/ColorProvider.hpp>
bool ModList::init(ModListSource* src, CCSize const& size) { bool ModList::init(ModListSource* src, CCSize const& size) {
if (!CCNode::init()) if (!CCNode::init())
@ -26,7 +27,9 @@ bool ModList::init(ModListSource* src, CCSize const& size) {
m_searchMenu->setContentSize({ size.width, 30 }); m_searchMenu->setContentSize({ size.width, 30 });
m_searchMenu->setAnchorPoint({ .5f, 1.f }); m_searchMenu->setAnchorPoint({ .5f, 1.f });
auto searchBG = CCLayerColor::create({ 83, 65, 109, 255 }); auto searchBG = CCLayerColor::create(
ColorProvider::get()->define("mod-list-search-bg"_spr, { 83, 65, 109, 255 })
);
searchBG->setContentSize(m_searchMenu->getContentSize()); searchBG->setContentSize(m_searchMenu->getContentSize());
searchBG->ignoreAnchorPointForPosition(false); searchBG->ignoreAnchorPointForPosition(false);
m_searchMenu->addChildAtPosition(searchBG, Anchor::Center); m_searchMenu->addChildAtPosition(searchBG, Anchor::Center);
@ -136,7 +139,9 @@ void ModList::onPromise(typename ModListSource::PageLoadEvent* event) {
for (auto item : *resolved) { for (auto item : *resolved) {
// Add separators between items after the first one // Add separators between items after the first one
if (!first) { if (!first) {
auto separator = CCLayerColor::create({ 255, 255, 255, 45 }); auto separator = CCLayerColor::create(
ColorProvider::get()->define("mod-list-separator"_spr, { 255, 255, 255, 45 })
);
separator->setContentSize({ m_obContentSize.width - 10, .5f }); separator->setContentSize({ m_obContentSize.width - 10, .5f });
m_list->m_contentLayer->addChild(separator); m_list->m_contentLayer->addChild(separator);
} }

View file

@ -1,8 +1,7 @@
#include "ModsLayer.hpp" #include "ModsLayer.hpp"
#include "SwelvyBG.hpp" #include "SwelvyBG.hpp"
#include <Geode/ui/TextInput.hpp> #include <Geode/ui/TextInput.hpp>
#include <Geode/utils/ColorProvider.hpp>
static bool BIG_VIEW = false;
bool ModsLayer::init() { bool ModsLayer::init() {
if (!CCLayer::init()) if (!CCLayer::init())
@ -54,7 +53,9 @@ bool ModsLayer::init() {
m_frame->setAnchorPoint({ .5f, .5f }); m_frame->setAnchorPoint({ .5f, .5f });
m_frame->setContentSize({ 380, 205 }); m_frame->setContentSize({ 380, 205 });
auto frameBG = CCLayerColor::create({ 25, 17, 37, 255 }); auto frameBG = CCLayerColor::create(
ColorProvider::get()->define("mod-list-bg"_spr, { 25, 17, 37, 255 })
);
frameBG->setContentSize(m_frame->getContentSize()); frameBG->setContentSize(m_frame->getContentSize());
frameBG->ignoreAnchorPointForPosition(false); frameBG->ignoreAnchorPointForPosition(false);
m_frame->addChildAtPosition(frameBG, Anchor::Center); m_frame->addChildAtPosition(frameBG, Anchor::Center);