Skip to content

Commit

Permalink
XWIKI-21584: Mentions do not have enough contrast
Browse files Browse the repository at this point in the history
* Added the foreground getter as an API in the new script service.
  • Loading branch information
Sereza7 committed Oct 16, 2024
1 parent dc610f3 commit e87afbf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.xwiki.mentions;

import org.xwiki.component.annotation.Role;
import org.xwiki.stability.Unstable;

/**
* Gives access to the configuration settings of the mentions.
Expand Down Expand Up @@ -53,10 +54,16 @@ public interface MentionsConfiguration
String getMentionsColor();

/**
* @return the color for the mentions to the current user.
* @return the background color for the mentions to the current user.
*/
String getSelfMentionsColor();

/**
* @return the foreground color for the mentions to the current user.
*/
@Unstable
String getSelfMentionsForeground();

/**
*
* @return {@code true} if the mentions quote feature is activated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.xwiki.mentions.MentionsFormatter;
import org.xwiki.mentions.internal.MentionFormatterProvider;
import org.xwiki.script.service.ScriptService;
import org.xwiki.stability.Unstable;

import static org.xwiki.mentions.MentionsConfiguration.MENTION_TASK_ID;

Expand Down Expand Up @@ -74,6 +75,17 @@ public String getSelfMentionsColor()
return this.configuration.getSelfMentionsColor();
}

/**
*
* @see MentionsConfiguration#getSelfMentionsForeground()
* @return the mentions foreground color configuration value for the current user.
*/
@Unstable
public String getSelfMentionsForeground()
{
return this.configuration.getSelfMentionsForeground();
}

/**
* @return the current size of the queue of elements (page, comments...) with mentions to analyze
* @since 12.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ public String getSelfMentionsColor()
return this.configuration.getProperty("selfMentionsColor", "rgba(255, 0, 1, 0.5)");
}

@Override
public String getSelfMentionsForeground()
{
// default color is rgba, not hexa to allow setting opacity and keep working on IE11
return this.configuration.getProperty("selfMentionsForeground", "rgba(255, 255, 255, 1)");
}

@Override
public boolean isQuoteActivated()
{
Expand Down

0 comments on commit e87afbf

Please sign in to comment.