aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CallTip.cxx17
-rw-r--r--src/EditView.cxx10
-rw-r--r--src/Geometry.h3
-rw-r--r--src/Indicator.h4
-rw-r--r--src/LineMarker.h4
-rw-r--r--src/MarginView.cxx2
-rw-r--r--src/Style.cxx4
-rw-r--r--src/ViewStyle.cxx9
-rw-r--r--src/XPM.cxx2
9 files changed, 32 insertions, 23 deletions
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index 87a2bab06..9a9428fee 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -37,6 +37,13 @@ size_t Chunk::Length() const noexcept {
return end - start;
}
+namespace {
+
+constexpr ColourRGBA silver(0xc0, 0xc0, 0xc0);
+constexpr ColourRGBA grey(0x80, 0x80, 0x80);
+
+}
+
CallTip::CallTip() noexcept {
wCallTip = {};
inCallTipMode = false;
@@ -57,14 +64,14 @@ CallTip::CallTip() noexcept {
#ifdef __APPLE__
// proper apple colours for the default
colourBG = ColourRGBA(0xff, 0xff, 0xc6);
- colourUnSel = ColourRGBA(0, 0, 0);
+ colourUnSel = black;
#else
- colourBG = ColourRGBA(0xff, 0xff, 0xff);
- colourUnSel = ColourRGBA(0x80, 0x80, 0x80);
+ colourBG = white;
+ colourUnSel = grey;
#endif
colourSel = ColourRGBA(0, 0, 0x80);
- colourShade = ColourRGBA(0, 0, 0);
- colourLight = ColourRGBA(0xc0, 0xc0, 0xc0);
+ colourShade = black;
+ colourLight = silver;
codePage = 0;
clickPlace = 0;
}
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 09a20eda3..8f413e963 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -2093,7 +2093,7 @@ ColourRGBA InvertedLight(ColourRGBA orig) noexcept {
const unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye
const unsigned int il = 0xff - l;
if (l == 0)
- return ColourRGBA(0xff, 0xff, 0xff);
+ return white;
r = r * il / l;
g = g * il / l;
b = b * il / l;
@@ -2714,15 +2714,15 @@ Sci::Position EditView::FormatRange(bool draw, CharacterRangeFull chrg, Rectangl
it->fore = InvertedLight(it->fore);
it->back = InvertedLight(it->back);
} else if (colourMode == PrintOption::BlackOnWhite) {
- it->fore = ColourRGBA(0, 0, 0);
- it->back = ColourRGBA(0xff, 0xff, 0xff);
+ it->fore = black;
+ it->back = white;
} else if (colourMode == PrintOption::ColourOnWhite || colourMode == PrintOption::ColourOnWhiteDefaultBG) {
- it->back = ColourRGBA(0xff, 0xff, 0xff);
+ it->back = white;
}
}
// White background for the line numbers if PrintOption::ScreenColours isn't used
if (colourMode != PrintOption::ScreenColours) {
- vsPrint.styles[StyleLineNumber].back = ColourRGBA(0xff, 0xff, 0xff);
+ vsPrint.styles[StyleLineNumber].back = white;
}
// Printing uses different margins, so reset screen margins
diff --git a/src/Geometry.h b/src/Geometry.h
index 89c9c08fb..28f2f022d 100644
--- a/src/Geometry.h
+++ b/src/Geometry.h
@@ -256,6 +256,9 @@ public:
ColourRGBA MixedWith(ColourRGBA other, double proportion) const noexcept;
};
+constexpr ColourRGBA white(maximumByte, maximumByte, maximumByte);
+constexpr ColourRGBA black(0x0, 0x0, 0x0);
+
/**
* Holds an RGBA colour and stroke width to stroke a shape.
*/
diff --git a/src/Indicator.h b/src/Indicator.h
index fc17a82c2..5bdccaf33 100644
--- a/src/Indicator.h
+++ b/src/Indicator.h
@@ -15,7 +15,7 @@ struct StyleAndColour {
ColourRGBA fore;
StyleAndColour() noexcept : style(Scintilla::IndicatorStyle::Plain), fore(0, 0, 0) {
}
- StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = ColourRGBA(0, 0, 0)) noexcept : style(style_), fore(fore_) {
+ StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = black) noexcept : style(style_), fore(fore_) {
}
bool operator==(const StyleAndColour &other) const noexcept {
return (style == other.style) && (fore == other.fore);
@@ -36,7 +36,7 @@ public:
XYPOSITION strokeWidth = 1.0f;
Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(Scintilla::IndicFlag::None) {
}
- Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_= ColourRGBA(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept :
+ Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_= black, bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept :
sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(Scintilla::IndicFlag::None) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, State drawState, int value) const;
diff --git a/src/LineMarker.h b/src/LineMarker.h
index 0a60da962..e82d6fe1e 100644
--- a/src/LineMarker.h
+++ b/src/LineMarker.h
@@ -22,8 +22,8 @@ public:
enum class FoldPart { undefined, head, body, tail, headWithTail };
Scintilla::MarkerSymbol markType = Scintilla::MarkerSymbol::Circle;
- ColourRGBA fore = ColourRGBA(0, 0, 0);
- ColourRGBA back = ColourRGBA(0xff, 0xff, 0xff);
+ ColourRGBA fore = black;
+ ColourRGBA back = white;
ColourRGBA backSelected = ColourRGBA(0xff, 0x00, 0x00);
Scintilla::Layer layer = Scintilla::Layer::Base;
Scintilla::Alpha alpha = Scintilla::Alpha::NoAlpha;
diff --git a/src/MarginView.cxx b/src/MarginView.cxx
index 6cc961db2..348b5dd05 100644
--- a/src/MarginView.cxx
+++ b/src/MarginView.cxx
@@ -138,7 +138,7 @@ void MarginView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw)
ColourRGBA colourFMFill = vsDraw.selbar;
ColourRGBA colourFMStripes = vsDraw.selbarlight;
- if (!(vsDraw.selbarlight == ColourRGBA(0xff, 0xff, 0xff))) {
+ if (!(vsDraw.selbarlight == white)) {
// User has chosen an unusual chrome colour scheme so just use the highlight edge colour.
// (Typically, the highlight colour is white.)
colourFMFill = vsDraw.selbarlight;
diff --git a/src/Style.cxx b/src/Style.cxx
index a45072292..fcde6398e 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -65,8 +65,8 @@ int DefaultFontSize() noexcept {
Style::Style(const char *fontName_) noexcept :
FontSpecification(fontName_, DefaultFontSize() * FontSizeMultiplier),
- fore(0,0,0),
- back(0xff, 0xff, 0xff),
+ fore(black),
+ back(white),
eolFilled(false),
underline(false),
caseForce(CaseForce::mixed),
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index b8fe0c0d6..a669fce4a 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -186,10 +186,10 @@ ViewStyle::ViewStyle(size_t stylesSize_) :
controlCharWidth = 0;
selbar = Platform::Chrome();
selbarlight = Platform::ChromeHighlight();
- styles[StyleLineNumber].fore = ColourRGBA(0, 0, 0);
+ styles[StyleLineNumber].fore = black;
styles[StyleLineNumber].back = Platform::Chrome();
- elementBaseColours[Element::Caret] = ColourRGBA(0, 0, 0);
+ elementBaseColours[Element::Caret] = black;
elementBaseColours[Element::CaretAdditional] = ColourRGBA(0x7f, 0x7f, 0x7f);
elementAllowsTranslucent.insert({
Element::Caret,
@@ -459,7 +459,7 @@ void ViewStyle::ClearStyles() {
styles[StyleLineNumber].back = Platform::Chrome();
// Set call tip fore/back to match the values previously set for call tips
- styles[StyleCallTip].back = ColourRGBA(0xff, 0xff, 0xff);
+ styles[StyleCallTip].back = white;
styles[StyleCallTip].fore = ColourRGBA(0x80, 0x80, 0x80);
}
@@ -622,8 +622,7 @@ ColourRGBA ViewStyle::ElementColourForced(Element element) const {
// This method avoids warnings for unwrapping potentially empty optionals from
// Visual C++ Code Analysis
const ColourOptional colour = ElementColour(element);
- constexpr ColourRGBA opaqueBlack(0, 0, 0, 0xff);
- return colour.value_or(opaqueBlack);
+ return colour.value_or(black);
}
bool ViewStyle::ElementAllowsTranslucent(Element element) const {
diff --git a/src/XPM.cxx b/src/XPM.cxx
index 5c7d8fee0..57c401eed 100644
--- a/src/XPM.cxx
+++ b/src/XPM.cxx
@@ -117,7 +117,7 @@ void XPM::Init(const char *const *linesForm) {
if (!linesForm)
return;
- std::fill(colourCodeTable, std::end(colourCodeTable), ColourRGBA(0, 0, 0));
+ std::fill(colourCodeTable, std::end(colourCodeTable), black);
const char *line0 = linesForm[0];
width = atoi(line0);
line0 = NextField(line0);