42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
/*
|
|
This file is part of Telegram Desktop,
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
For license and copyright information please follow this link:
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
*/
|
|
#include "iv/markdown/iv_markdown_theme.h"
|
|
|
|
#include "iv/markdown/iv_markdown_prepare_native_richtext.h"
|
|
#include "ui/chat/chat_style.h"
|
|
#include "ui/chat/chat_theme.h"
|
|
|
|
#include "styles/palette.h"
|
|
|
|
namespace Iv::Markdown {
|
|
|
|
std::vector<Ui::Text::SpecialColor> HighlightColors(
|
|
not_null<const Ui::ChatStyle*> style) {
|
|
auto result = Ui::SyntaxHighlightColors(style);
|
|
|
|
const auto &fg = style->lightButtonFg();
|
|
const auto &bg = style->lightButtonBgOver();
|
|
result.push_back({ &fg->p, &fg->p, &bg->b, &bg->b });
|
|
|
|
Ensures(result.size() == kNativeIvLinkSpecialColorIndex);
|
|
return result;
|
|
}
|
|
|
|
std::unique_ptr<Ui::ChatTheme> CreateStandaloneChatTheme() {
|
|
const auto palette = style::main_palette::get();
|
|
return std::make_unique<Ui::ChatTheme>(Ui::ChatThemeDescriptor{
|
|
.preparePalette = [=](style::palette ©) {
|
|
copy = *palette;
|
|
},
|
|
.backgroundData = {
|
|
.colors = { palette->windowBg()->c },
|
|
},
|
|
});
|
|
}
|
|
|
|
} // namespace Iv::Markdown
|