add support for cperl-mode
Added the three cperl-mode specific faces.
Mapped the original defface class color background light
- cperl-nonoverridable-face :: foreground chartreuse3
- cperl-array-face :: foreground Blue, background lightyellow2, weight bold
- cperl-hash-face :: foreground Red, background lightyellow2, weight bold, slant italic
to modus-operandi.
And class color background dark
- cperl-nonoverridable-face :: foreground orchid1|orange
- cperl-array-face :: foreground yellow, background navy|os2blue|darkgreen, weight bold
- cperl-hash-face :: foreground Red, background navy|os2blue|darkgreen, weight bold, slant italic
to modus-vivendi.
Not sure about the colours I chose, like yellow-alt-faint for orange. With the goal of highest contrast between foreground and background, I think, the low contrast between the different foreground colour unavoidable.
Checked with the following code example.
print <<EOF;
this is a multiline here document
need to see on a glane the tag used
EOF
s#match#replace#;
my @array = ( 'a', 'b', 'c' );
my $normal_variable = 5;
my %hash = { 'x' => 5, 'y' => 7 };
$hash{'z'} = 9;
Merge request reports
Activity
Thank you @mbeppler for this! In legal terms, you would not need to assign copyright to the FSF because this is a small contribution line-wise. So we are good on that front.
Not sure about the colours I chose, like yellow-alt-faint for orange. With the goal of highest contrast between foreground and background, I think, the low contrast between the different foreground colour unavoidable.
I use the "faint" colours mostly for the customisation option for toning down programming mode (we could add it here as well---see how the standard font lock is done, if you want).
For my part, the only tweak I would like to see is to use the same colours for both themes. I try to keep them as close as possible for the sake of convenience (divergences are possible, though they should be necessary).
I do not mind what the exact choice of colour is. Given your sample code, I thought the following could do the trick (though feel free to edit it further, as this might not be good enough in another context):
`(cperl-nonoverridable-face ((,class :foreground ,yellow-alt-other))) `(cperl-array-face ((,class :inherit bold :background ,bg-alt :foreground ,magenta-alt))) `(cperl-hash-face ((,class :inherit bold :background ,bg-alt :foreground ,red-alt :slant italic)))
Finally, I believe we should make the italic slant optional. It seems that the different colour and the added background already offer elements of differentiation. So like this:
:slant ,modus-theme-slant
. What do you think?I'm only started to use your theme Yesterday. Liking it so far very much, but not familiar with the nuance. My choice was to mimic the original values, like a different background for the array and hash. Like you I don't care about the exact colour, but that I'm able to see the differences. And with your change I still do.
Never the less I think the colours used are a personal taste. For this it should be simple to change it in on place for ones own liking. This is way I added this in the first place, to experiment. For me it is mainly font-lock-constant-face and font-lock-string-face.
Please feel free to adopt accordingly.
I'm only started to use your theme Yesterday. Liking it so far very much, but not familiar with the nuance.
That's okay, no worries. I can help you with anything you may need.
Like you I don't care about the exact colour, but that I'm able to see the differences. And with your change I still do.
Never the less I think the colours used are a personal taste. For this it should be simple to change it in on place for ones own liking. This is way I added this in the first place, to experiment. For me it is mainly font-lock-constant-face and font-lock-string-face.
If you want to experiment some more with the colours to make them look more different, feel free to adapt the following code (both themes should share it):
`(cperl-nonoverridable-face ((,class :foreground ,yellow-alt-other))) `(cperl-array-face ((,class :inherit bold :background ,bg-alt :foreground ,magenta-alt))) `(cperl-hash-face ((,class :inherit bold :background ,bg-alt :foreground ,red-alt :slant ,modus-theme-slant)))
If you need help with some possible colours to use, just let me know.
If you want to experiment some more with the colours to make them look more different, feel free to adapt the following code (both themes should share it)
Sorry. I think there is a misunderstanding. The colours for the three cperl faces where all fine
- without the patch
- with my original patch (matching original mode colours)
- with your suggested change (matching the overall theme)
My problem lies with the difference of font-lock-constant-face to font-lock-string-face. This is not a problem of this merge request. From my point of view this is OK.
TL:DR
Some of the perl code I maintain contains many here documents and short regular expressions. In these cases I only care for the recognition of the position (often only a single character like the delimiter between the matching and replaceing rule). And don't need to read something with this colour.
For this I'm experimenting with font-lock-constant-face:
- yellow-intense-bg 1.35:1 to bg and 6.1:1 to string
- cyan-intense-bg to bg 1.95:1 and 4.23:1 to string
- blue-intense-bg to bg 2.30:1 and 3.59:1 to string
I know, this not only totally breaks the rule of this theme but also I don't know about the side effects it has on other modes. This is therefore a good example for a personal change.
PS with size gitlab displays the screenshoot it is quite a difference to the actual "small" font I use
I know, this not only totally breaks the rule of this theme but also I don't know about the side effects it has on other modes. This is therefore a good example for a personal change.
Let me review those colours. I think we can fix it for everyone.
I think it is ready to merge.
Okay, will do it right away.
mentioned in commit f2be6156
Thanks for the merge.
Yes, I know. I hope I didn't create the impression that I wanted one of the commonly used font-lock faces to be changed.
Tried your suggestion with font-lock-constant-face set to bold for some time. This is not a solution for me as I need to concentrate to see the difference. With one of the -intense-bg colours as foreground I see it immediately.
Never the less adding the optional bold to font-lock-constant-face could be a good solution for others.
This is the first time I used something else than the vanilla emacs theme for more than a hour. I'm using mainly operandi for three days now. Liking it very much and will continue using it. Changing only one face is much better than expected - for a tweaking emacs user
Thank you very much for creating this theme and making me aware of the W3 WCGA contrast information and how to calculate the contrast.
Thanks for the merge.
You are welcome! And thanks again for doing this.
Tried your suggestion with font-lock-constant-face set to bold for some time. This is not a solution for me as I need to concentrate to see the difference. With one of the -intense-bg colours as foreground I see it immediately.
I see. The ideal would be for cperl-mode to offer some customisation option instead of hard-wiring
font-lock-constant-face
. This appears to be the case with those:(defcustom cperl-pod-face 'font-lock-comment-face "Face for POD highlighting." :type 'face :group 'cperl-faces) (defcustom cperl-pod-head-face 'font-lock-variable-name-face "Face for POD highlighting. Font for POD headers." :type 'face :group 'cperl-faces) (defcustom cperl-here-face 'font-lock-string-face "Face for here-docs highlighting." :type 'face :group 'cperl-faces)
Perhaps
(setq cperl-here-face 'font-lock-doc-face)
would be of help?Thank you very much for creating this theme and making me aware of the W3 WCGA contrast information and how to calculate the contrast.
If you need any additional resources you could check what I share in some of my articles about the design of the themes. For example: https://protesilaos.com/codelog/2020-08-09-modus-themes-paren-match/
mentioned in commit c82a754f
mentioned in commit aa992612