Setting custom colors in PhpStorm - phpstorm

I am trying to customize the color scheme in PhpStorm to my liking. What I would like to do is set a different color for words like 'public', 'private' or 'protected' and the actual word 'function' when inside a class.
However, if I go to Settings->Colors & Fonts->PHP, I can't figure out how to do that. It seems that all of these words are considered Keywords and therefore have to have the same color.
Is there are a way around this?

Such functionality is not supported ATM.
https://youtrack.jetbrains.com/issue/WI-22194 -- watch this ticket (star/vote/comment) to get notified on any progress. So far it's not scheduled for any specific future release .. plus it has only 2 votes.

Related

NetBeans Highlighting Issue in HTML

I'm using NetBeans 12 and I hate the fact that it highlights all instances of classnames in HTML and leaves them highlighted with no apparent way to remove the highlighting until another classname/id is selected.
I have searched for answers, and a common one is to use Tools > Options > Editor > Highlighting and deselect "mark occurrences of symbol under carat." I think that is for a different problem though, and for some reason the only language in the dropdown is PHP, so I can't uncheck this for HTML anyway.
Please tell me how I can stop this annoying behaviour, or at least use a keyboard shortcut to remove the highlighting. I would have though something like ESC would be set up to do this as default, but no...
Go to Tools > Options > Fonts & Colors
There you will see a drop-down list of different style profiles. In my case, I have "FlatLaf Light" selected. Yours may be different, but that should not matter.
Choose the "Syntax" sub-menu.
In the "language" list choose "HTML"
In the "Category" list, scroll down to "CSS embedded in HTML" and then select it.
Change the "Background" color to "Inherited".
Hit "Apply" to save your changes.
In my case, this looks as follows:
Before the change:
After the change:
This changes the (very specific) highlighting issue shown in your question's screenshot. But you may want to make a similar change in other places... For example, you can see the opening and closing (matching) <ul> tags are highlighted (which I find useful).
So, you can also take a look at other languages - and even the "All Languages" option for a broader range of places where similar changes can be made (e.g "Mark Occurrences"). But I have not investigated these in any detail.
Final notes - all subjective and based on personal preferences...
You may choose to keep the highlighting feature, but to use a less intrusive color, of course, instead of completely removing it.
I am using NetBeans 15 - so that may affect which overall look and feel themes you have available, also. But a different theme (retaining the highlighting) may also be another option.

Get text outline in as3

I have a flash application and i am trying to create a hand write effect, it will have to draw the outline of the text , so i need the outline of the text , I could have got it if it is predefined fonts , but my users can upload fonts too , so is there any way i can extract outlines of a text in run time? any help is appreciated
I know about readGraphicsData, but it wont help!
We had this question before (can't find it). It boils down to this:
There's afaik no trivial way to access the vector outline of text. Yes, you can read the font file (like any other file) and just parse it. Any font description file obviously includes the font outline in some way. You'd have to read the specification of that font file and extract the desired information accordingly.
For example, according to the OpenType specification's Font File Tables, the Tables Related to TrueType Outlines contain a glyph tag wherein you can find numberOfContours, xCoordinates[ ], yCoordinates[ ], etc.
I haven't come across a library that reads font description files and extracts that data conveniently, so you'd have to parse it yourself, which is - just to be clear here - an insane amount of work. You could try to find a library in some other language like C and see if you can somehow use it in As3. That might be less work, but it's complicated.
However, there's a flaw in your premise anyway:
I have a flash application and i am trying to create a hand write effect, it will have to draw the outline of the text
There's pretty much no way to accomplish this. In order to do this, knowing the outline is not enough. To write each glyph, a number of strokes are made. There's no general way to know how a glyph would be written by hand only from its outline.
If you know the outline of an
A
nothing tells you that the steps to handwrite it are
/
\
––
Fonts might have additional lines. If I wanted to use a service that produces handwriting from a font that I supply, I'd be inclined to use a calligraphic font with plenty of additional loops, curves, etc. There's no trivial way to automate this.

Sublime Text 3 Multiple Language code highlight

I just upgraded to Sublime Text 3.
I'm using my existing Color scheme from Sublime Text 2. But now multi language code highlighting no longer works.
Sublime Text 3
Sublime Text 2
Can someone help me comeup with the custom scope for my tmTheme.
Congratulations on upgrading, it was a good choice. I'm using ST3 Build 3120, the latest development build, so the language definitions may have changed somewhat, but not significantly, if you're using the public beta Build 3114. I also use the Neon Color Scheme (full disclosure: I'm the developer), which has a very large number of specific scopes compared to some other color schemes like Monokai or Solarized which reuse the same colors for a variety of different language features. Finally, since I'm a color scheme designer, I use tools like ScopeHunter and ScopeAlways to determine which scopes and theming elements are active at any point in the text.
So, here's a screencap of your code plus a couple of other test lines using Sublime's HTML syntax:
and here is the same code, moments later, captured using the PHP syntax:
What we can see is that, in the lower left corner, ScopeAlways is indicating that, at the position of the cursor, the base scope of the HTML file is text.html.basic, while the PHP one is embedding.php text.html.basic. So far, so good - this is normal. More importantly, however, we can see the obvious difference in highlighting between HTML and PHP, including the contents of the id attribute as compared to the other attributes, and the coloring (or lack thereof) of the embedded PHP code (yes, I know I'm missing a ; at the end of the isolated PHP code at the bottom - adding one in doesn't change anything).
So, my first suggestion would be, if you're not already using it, is to set the syntax of the file to PHP. You can either select from the menu on the far right side of the bottom bar, or by selecting View → Syntax → and choosing from the options available.
If you're already using the PHP syntax, you should know that since the beginning of this year (more or less), many of Sublime's language description syntax files have been significantly or completely rewritten, PHP and HTML among them. They were in sore need of modernization and speed-up in some cases, and with the advent of the sublime-syntax format (much more powerful than the old, but still supported, tmLanguage format), a better regex engine for .sublime-syntax files, and the hiring by Sublime HQ of Will Bond (of Package Control fame) to do a lot of things that Jon Skinner (Sublime's author) didn't have time or interest in doing, the development process of both Sublime itself as well as the syntax definitions (which were open-sourced at the same time) has increased substantially. That is a really long-winded way of saying that a lot of stuff has changed in a relatively short amount of time, and color schemes that were written with the old versions of the HTML and PHP syntaxes in mind may not be perfect for the new versions. So, you may want to either go through the new syntaxes and update your color scheme, if you're that kind of person, or you can try some other schemes like Neon, which have already been through that process.
Getting back to that weird id highlighting - I'm going to release a new version of Neon fairly soon that fixes that issue, and colors the contents of the id attribute just like class or any other attribute. I'll also try and find out why they did that.
I hope this helps. Good luck!

Sublime Text 2 color scheme - change object key color

I'm wondering if there is a way to change the default color of object keys in Sublime Text 2.
I looked at this SO Q: Sublime Text 2: How do I change the color that the row number is highlighted? and it didnt have quite what I was looking for; The Tm-Theme Editor suggested is pretty awesome but doesnt seem to do what I want.
So, for example, with:
var foo = {
key1 : 1,
key2 : 2
}
By default key1 and key2 are white. I'd like to make them a separate color. I cant find the right tag in the .thTheme file I am currently using.
Unfortunately, the standard JavaScript language definition that comes with Sublime does not include a scope for keys, so there's no way to color it differently. However, if you switch to using Java​Script​Next - ES6 Syntax, which is a much more detailed language definition, you'll be able to use the constant.other.object.key.js scope to color the keys. Here is the difference between using standard JS:
and JavaScriptNext:
Syntax highlighting is courtesy of my Neon Color Scheme, which has been designed to make as many languages as possible look as good as possible, using as many different scopes as possible. I've included several JavaScriptNext-specific items in it, including object names, Node keywords, constants, properties, and others. Please feel free to open an issue if you have any questions, concerns, feature requests, or other feedback. If you don't want to change over from your old color scheme, you can of course borrow whatever features you like from the source.
Hope this helps!

Why do weird things in font color attribute produce real colors? [duplicate]

This question already has answers here:
Why does HTML think “chucknorris” is a color?
(10 answers)
Closed 2 years ago.
I'm teaching a jr. high/high school web programming class, and we're starting with simple elements and attributes like font and color before moving on to CSS. I know color is deprecated and font is not included in HTML5, but for teaching purposes, I find it convenient to start with simple HTML tags and work our way up to CSS. The students get a lot of joy out of being able to change colors on a page during the first week of class. (I also teach them marquee and blink in week 1, but inform them that if they ever use them again, they will lose points).
One of the students started submitting homework with odd things in the color attribute values, like "Skittles" or "Spiderman". I started experimenting with this and discovered that just about anything you put into the color="" attribute on the font tag produces some sort of color. And it appears that the color is consistent across the latest versions of IE, Firefox, Chrome, Opera, and Safari.
I have discovered that putting "LuckyCharms" in as a CSS color DOES NOT WORK. It only seems to work where colors are expected in HTML attributes, for example font color="LuckyCharms", or body bgcolor="LuckyCharms".
I'm trying to explain to my class why this happens, and so far I haven't been able to make sense of it, or to Google a good answer. It would appear that it's being interpreted as a color code, but I can't make sense of how.
UPDATE: After some trial and error, I have determined a 5-step algorithm (using the link provided) to convert pretty much any string into the corresponding hex color. I will provide the algorithm here for the edification of future visitors:
Change each non-hex character to a 0.
Add 0's to the string until its length is a multiple of 3.
Divide string into 3 equal parts.
While the length of the sub-strings is greater than 2, and all three of the sub-strings begin with a 0, remove the leading 0s from each string.
If the length of the sub-strings is still greater than 2, then truncate each substring to 2 characters.
That's it, put the substrings together and you've got your hex color code. I have verified this algorithm with about 20 different samples and compared the results using the Firefox ColorZilla add-on color picker.
Note that in this case, the rules ARE indeed specifically stated in the link specified in one of the answers and will be adhered to by all browsers. So it is something you can count on to work in any browser (should you really want to use funny color names).
The HTML 5 specification includes the rules for parsing legacy colours.
They are rather long, and are designed to allow browsers to be consistent about how they handle broken code.
Very interesting. Seems as though the browser will interpret any character it can (a-f) and leave the rest to be 0's if it can't match. For instance:
Spiderman
00DE0 A
Still needs more experimenting though.
This is an intriguing question.
Through brief experimentation, I've found that "Luck" produces the same color (to my eyes, anyway) as "LuckyCharms" but "LuckBeALady" gets you a darker shade, while "LuckBeALadyTonight" is bluer.
BTW, my first thought was that it was acting on the recognizable hex characters, but that turns "LuckyCharms" into cca, which rendered black. Combinations of 0's and the hex chars, as Madara Uchiba suggests, failed to render the same grass green as "LuckyCharms"
Don't have an answer tho.
The basic answer for what is expected to happen is "it depends on the browser". One of the problems with previous versions of HTML before 5 is that it is unspecified what happens when non-standard HTML is encountered by the browser. The interpretation from #Madara Uchiha is one example of how a browser might interpret the color specification, but it's just as allowable, standards-wise, for the browser to crash or to eject the CD tray or to change the resolution of your monitor to 400x300 px. Of course, this is not ideal - so what you're seeing is one programmer's idea, at one time, as to what should happen if a non-standard HTML color specification is encountered.
The reason it doesn't happen with CSS is that it's a different parser interpreting the color. This same parser interprets the color whether it's inline CSS or in a linked-in CSS document. CSS does define what happens to an improper value when it is encountered: it is ignored, and does not affect the document at all.
I would say this is a good time to talk to the class about standards compliance, as this is a critical field of understanding for students - and some professionals I have the misfortune to know. When they say, "But color Skittles works just fine", you can tell them that it works fine when they look at it, but it's entirely possible that it would crash their instructors' browser, earning them a big fat F. That's as close to a real-world scenario as you can get, when some of us have to give up our weekends because at demo time somebody else's crappy code doesn't work correctly.
I ain't bitter though. Mostly :)