Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Commit

Permalink
added option to force bright font colors on titlebars for single windows
Browse files Browse the repository at this point in the history
  • Loading branch information
n4n0GH committed Nov 8, 2019
1 parent af4f03b commit 33a0aad
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
6 changes: 3 additions & 3 deletions kdecoration/breezewaydecoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ namespace Breezeway
const QRgb brightFont = 0xFFFFFFFF;
QColor color = ( this->titleBarColor() );
int y = 0.2126*color.red()+0.7152*color.green()+0.0722*color.blue();
QColor newFont ( y > 128 ? color.lighter(40) : brightFont );
QColor newFont ( forceBrightFonts() ? brightFont : y > 128 ? color.lighter(40) : brightFont );
auto c = client().data();
if( m_animation->state() == QPropertyAnimation::Running )
{
if ( m_internalSettings->matchTitleBarColor() || customColorBoxEx() ){
return KColorUtils::mix(
y > 128 ? newFont.lighter(140) : color.lighter(140),
forceBrightFonts() ? color.lighter(140) : y > 128 ? newFont.lighter(140) : color.lighter(140),
newFont,
m_opacity );
} else {
Expand All @@ -289,7 +289,7 @@ namespace Breezeway
}
} else {
if ( m_internalSettings->matchTitleBarColor() || customColorBoxEx() ){
return c->isActive() ? newFont : y > 128 ? newFont.lighter(140) : color.lighter(140);
return c->isActive() ? newFont : forceBrightFonts() ? color.lighter(140) : y > 128 ? newFont.lighter(140) : color.lighter(140);
} else {
return c->color( c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::Foreground );

Expand Down
4 changes: 4 additions & 0 deletions kdecoration/breezewaydecoration.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ namespace Breezeway
inline bool hideTitleBar() const;
inline bool matchTitleBarColor( void ) const;
inline bool customColorBoxEx() const;
inline bool forceBrightFonts() const;
//@}

public Q_SLOTS:
Expand Down Expand Up @@ -215,6 +216,9 @@ namespace Breezeway
bool Decoration::customColorBoxEx() const
{ return m_internalSettings->customColorBoxEx(); }

bool Decoration::forceBrightFonts() const
{ return m_internalSettings->forceBrightFonts(); }

}

#endif
3 changes: 2 additions & 1 deletion kdecoration/breezewayexceptionlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ namespace Breezeway
// custom titlebar color settings
configuration->setCustomColorBoxEx( exception.customColorBoxEx() );
configuration->setCustomColorSelectEx( exception.customColorSelectEx() );
configuration->setForceBrightFonts( exception.forceBrightFonts() );

// append to exceptions
_exceptions.append( configuration );
Expand Down Expand Up @@ -101,7 +102,7 @@ namespace Breezeway
{

// list of items to be written
QStringList keys = { "Enabled", "ExceptionPattern", "ExceptionType", "HideTitleBar", "Mask", "BorderSize", "CustomColorBoxEx", "CustomColorSelectEx"};
QStringList keys = { "Enabled", "ExceptionPattern", "ExceptionType", "HideTitleBar", "Mask", "BorderSize", "CustomColorBoxEx", "CustomColorSelectEx", "ForceBrightFonts"};

// write all items
foreach( auto key, keys )
Expand Down
4 changes: 4 additions & 0 deletions kdecoration/breezewaysettingsdata.kcfg
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@
<default>231, 232, 235</default>
</entry>

<entry name="ForceBrightFonts" type = "Bool">
<default>false</default>
</entry>

<!-- window specific settings -->
<entry name="ExceptionType" type="Enum">
<choices>
Expand Down
4 changes: 4 additions & 0 deletions kdecoration/config/breezewayexceptiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace Breezeway
// check for custom titlebar color
connect( m_ui.customColorBoxEx, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( m_ui.customColorSelectEx, SIGNAL(changed(QColor)), SLOT(updateChanged()) );
connect( m_ui.forceBrightFonts, SIGNAL(clicked()), SLOT(updateChanged()) );

for( CheckBoxMap::iterator iter = m_checkboxes.begin(); iter != m_checkboxes.end(); ++iter )
{ connect( iter.value(), SIGNAL(clicked()), SLOT(updateChanged()) ); }
Expand Down Expand Up @@ -86,6 +87,7 @@ namespace Breezeway

m_ui.customColorBoxEx->setChecked( m_exception->customColorBoxEx() );
m_ui.customColorSelectEx->setColor( m_exception->customColorSelectEx() );
m_ui.forceBrightFonts->setChecked( m_exception->forceBrightFonts() );

// mask
for( CheckBoxMap::iterator iter = m_checkboxes.begin(); iter != m_checkboxes.end(); ++iter )
Expand All @@ -104,6 +106,7 @@ namespace Breezeway
m_exception->setHideTitleBar( m_ui.hideTitleBar->isChecked() );
m_exception->setCustomColorBoxEx( m_ui.customColorBoxEx->isChecked() );
m_exception->setCustomColorSelectEx( m_ui.customColorSelectEx->color() );
m_exception->setForceBrightFonts( m_ui.forceBrightFonts->isChecked() );

// mask
unsigned int mask = None;
Expand All @@ -126,6 +129,7 @@ namespace Breezeway
else if( m_exception->hideTitleBar() != m_ui.hideTitleBar->isChecked() ) modified = true;
else if( m_exception->customColorBoxEx() != m_ui.customColorBoxEx->isChecked() ) modified = true;
else if( m_exception->customColorSelectEx() != m_ui.customColorSelectEx->color() ) modified = true;
else if( m_exception->forceBrightFonts() != m_ui.forceBrightFonts->isChecked() ) modified = true;
else
{
// check mask
Expand Down
37 changes: 22 additions & 15 deletions kdecoration/config/ui/breezewayexceptiondialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>450</width>
<height>386</height>
<height>413</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -86,16 +86,6 @@
<string>Decoration Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="4" column="0">
<widget class="QCheckBox" name="customColorBoxEx">
<property name="locale">
<locale language="English" country="Germany"/>
</property>
<property name="text">
<string>Custom title bar color:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="borderSizeComboBox">
<property name="enabled">
Expand Down Expand Up @@ -148,24 +138,41 @@
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="customColorBoxEx">
<property name="locale">
<locale language="English" country="Germany"/>
</property>
<property name="text">
<string>Custom title bar color:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="borderSizeCheckBox">
<property name="text">
<string>Border size:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KColorButton" name="customColorSelectEx">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="hideTitleBar">
<property name="text">
<string>Hide window title bar</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KColorButton" name="customColorSelectEx">
<property name="enabled">
<bool>false</bool>
<item row="5" column="0">
<widget class="QCheckBox" name="forceBrightFonts">
<property name="text">
<string>Force bright title bar fonts</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 33a0aad

Please sign in to comment.