mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-08 21:44:35 +12:00
bd5d697830
commitc296ac13cd
Merge:9a1e760
091c30a
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit9a1e760a66
Merge:9c8af4d
22e64ca
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit9c8af4df43
Merge:8a49d8c
2217cbe
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit8a49d8cf45
Merge:1556388
008fcd8
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit1556388c83
Merge:1b126f5
d17e1a2
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commitd17e1a2dac
Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit4d8aa6b118
Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit22e64caaff
Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit2217cbe143
Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit008fcd889e
Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit0fdca5eb03
Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commitdcbdb7360d
Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit1b126f55e3
Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commitc8ec6bbb00
Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit8a33aab588
Merge:94e5c02
e4abcef
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit94e5c02d11
Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit091c30ab2b
Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commite4abcefbf9
Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commitd53307f14c
Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit594f42b9eb
Merge:aca2e4b
53d6eba
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commitaca2e4be75
Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit33faa01910
Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit53d6ebabc0
Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
71 lines
2.5 KiB
C++
71 lines
2.5 KiB
C++
/* Copyright 2021 Aristocratos (jakob@qvantnet.com)
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
indent = tab
|
|
tab-size = 4
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <robin_hood.h>
|
|
|
|
using std::array;
|
|
using std::string;
|
|
using std::vector;
|
|
using robin_hood::unordered_flat_map;
|
|
|
|
namespace Theme {
|
|
extern std::filesystem::path theme_dir;
|
|
extern std::filesystem::path user_theme_dir;
|
|
|
|
//* Contains "Default" and "TTY" at indeces 0 and 1, otherwise full paths to theme files
|
|
extern vector<string> themes;
|
|
|
|
//* Generate escape sequence for 24-bit or 256 color and return as a string
|
|
//* Args hexa: ["#000000"-"#ffffff"] for color, ["#00"-"#ff"] for greyscale
|
|
//* t_to_256: [true|false] convert 24bit value to 256 color value
|
|
//* depth: ["fg"|"bg"] for either a foreground color or a background color
|
|
string hex_to_color(string hexa, bool t_to_256=false, const string& depth="fg");
|
|
|
|
//* Generate escape sequence for 24-bit or 256 color and return as a string
|
|
//* Args r: [0-255], g: [0-255], b: [0-255]
|
|
//* t_to_256: [true|false] convert 24bit value to 256 color value
|
|
//* depth: ["fg"|"bg"] for either a foreground color or a background color
|
|
string dec_to_color(int r, int g, int b, bool t_to_256=false, const string& depth="fg");
|
|
|
|
//* Update list of paths for available themes
|
|
void updateThemes();
|
|
|
|
//* Set current theme from current "color_theme" value in config
|
|
void setTheme();
|
|
|
|
extern unordered_flat_map<string, string> colors;
|
|
extern unordered_flat_map<string, array<int, 3>> rgbs;
|
|
extern unordered_flat_map<string, array<string, 101>> gradients;
|
|
|
|
//* Return escape code for color <name>
|
|
inline const string& c(const string& name) { return colors.at(name); }
|
|
|
|
//* Return array of escape codes for color gradient <name>
|
|
inline const array<string, 101>& g(string name) { return gradients.at(name); }
|
|
|
|
//* Return array of red, green and blue in decimal for color <name>
|
|
inline const std::array<int, 3>& dec(string name) { return rgbs.at(name); }
|
|
|
|
}
|