NAP
imguistyle.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Local Includes
8 #include "imgui/imgui.h"
9 
10 // External Includes
11 #include <color.h>
12 #include <utility/dllexport.h>
13 
14 namespace nap
15 {
16  namespace gui
17  {
18  inline constexpr float dpi = 96.0f;
19  inline constexpr int pointerInvalidID = -3;
20  inline constexpr int pointerMouseID = -2;
21  inline constexpr int pointerTouchID = -1;
22 
26  enum class EColorScheme
27  {
28  Light = 0,
29  Dark = 1,
30  HyperDark = 2,
31  Classic = 3,
32  Custom = 4
33  };
34 
38  struct NAPAPI ColorPalette
39  {
40  ColorPalette() = default;
41  RGBColor8 mBackgroundColor = { 0x2D, 0x2D, 0x2D };
42  RGBColor8 mDarkColor = { 0x00, 0x00, 0x00 };
43  RGBColor8 mMenuColor = { 0x8D, 0x8B, 0x84 };
44  RGBColor8 mFront1Color = { 0x8D, 0x8B, 0x84 };
45  RGBColor8 mFront2Color = { 0xAE, 0xAC, 0xA4 };
46  RGBColor8 mFront3Color = { 0xCD, 0xCD, 0xC3 };
47  RGBColor8 mFront4Color = { 0xFF, 0xFF, 0xFF };
48  RGBColor8 mHighlightColor1 = { 0x29, 0x58, 0xff };
49  RGBColor8 mHighlightColor2 = { 0xD6, 0xFF, 0xA3 };
50  RGBColor8 mHighlightColor3 = { 0xFF, 0xEA, 0x30 };
51  RGBColor8 mHighlightColor4 = { 0xFF, 0x50, 0x50 };
52  bool mInvertIcon = false;
53  };
54 
58  struct NAPAPI Style
59  {
60  Style() = default;
61  bool mAntiAliasedLines = true;
62  bool mAntiAliasedFill = true;
63  glm::vec2 mWindowPadding = { 10.0, 10.0f };
64  float mWindowRounding = 0.0f;
65  glm::vec2 mFramePadding = { 5.0f, 5.0f };
66  float mFrameRounding = 0.0f;
67  glm::vec2 mItemSpacing = { 12.0f, 6.0f };
68  glm::vec2 mItemInnerSpacing = { 8.0f, 6.0f };
69  float mIndentSpacing = 25.0f;
70  float mScrollbarSize = 13.0f;
71  float mScrollbarRounding = 0.0f;
72  float mGrabMinSize = 5.0f;
73  float mGrabRounding = 0.0f;
74  float mWindowBorderSize = 0.0f;
75  float mPopupRounding = 0.0f;
76  float mChildRounding = 0.0f;
77  glm::vec2 mWindowTitleAlign = { 0.5f, 0.5f };
78  float mPopupBorderSize = 0.0f;
79  float mTabRounding = 0.0f;
80  glm::vec2 mTouchExtraPadding = { 0.0f, 0.0f };
81  };
82 
88  NAPAPI const ColorPalette* getPalette(EColorScheme colorScheme);
89 
96  NAPAPI ColorPalette& registerCustomPalette(const gui::ColorPalette& palette);
97 
103  NAPAPI void applyPalette(const gui::ColorPalette& palette, ImGuiStyle& ioStyle);
104 
111  NAPAPI std::unique_ptr<ImGuiStyle> createStyle(const gui::ColorPalette& palette, const gui::Style& style);
112  }
113 }
nap::gui::EColorScheme::Light
@ Light
Lighter color scheme.
nap::gui::getPalette
const NAPAPI ColorPalette * getPalette(EColorScheme colorScheme)
nap::RGBColor< uint8 >
nap::gui::applyPalette
NAPAPI void applyPalette(const gui::ColorPalette &palette, ImGuiStyle &ioStyle)
nap::gui::createStyle
NAPAPI std::unique_ptr< ImGuiStyle > createStyle(const gui::ColorPalette &palette, const gui::Style &style)
nap::gui::pointerMouseID
constexpr int pointerMouseID
Pointer from mouse ID.
Definition: imguistyle.h:20
nap::gui::EColorScheme::Dark
@ Dark
Darker color scheme (default)
nap::gui::pointerTouchID
constexpr int pointerTouchID
Pointer from touch ID.
Definition: imguistyle.h:21
nap::gui::EColorScheme
EColorScheme
Definition: imguistyle.h:26
nap::gui::pointerInvalidID
constexpr int pointerInvalidID
Invalid pointer ID.
Definition: imguistyle.h:19
nap::gui::ColorPalette
Definition: imguistyle.h:38
nap::gui::registerCustomPalette
NAPAPI ColorPalette & registerCustomPalette(const gui::ColorPalette &palette)
nap::gui::EColorScheme::Classic
@ Classic
Classic color scheme.
nap::gui::Style
Definition: imguistyle.h:58
nap
Definition: templateapp.h:17
nap::gui::dpi
constexpr float dpi
Default (reference) dpi for gui elements.
Definition: imguistyle.h:18
nap::gui::EColorScheme::Custom
@ Custom
Custom color scheme.
nap::gui::EColorScheme::HyperDark
@ HyperDark
High contrast dark color scheme.