Sublime Forum

How to automatically pop up the value of a attribute?

#1

For example,I make such tags:


if I enter background-color,it will not pop “red”,I must fill the value myself.

Do it exist such snippet which can automatically pop up value of this attribute?

0 Likes

#2

Do you mean something like this?

0 Likes

#3

Not like this,but thank u.

0 Likes

#4

I don’t understand what you want to do, but have a look to the unofficial documentation about snippets.

0 Likes

#5

I think you are asking how to implement context-specific auto-complete for color values @ CSS files.

 
If so, this should work:
 



#[1]
 
##     Install:
##     PackageResourceViewer

 



#[2]
 
##     Open the command palette & run:
        PackageResourceViewer: Open Resource

##     Select:
        CSS / css_completions.py

 



#[3]
 
##     Replace:

		'background-color': ['<color>'],

              * and any other color properties you want to affect *
 
##     With:

		'background-color': ["AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque", "Black",
				"BlanchedAlmond", "Blue", "BlueViolet", "Brown", "BurlyWood", "CadetBlue",
				"Chartreuse", "Chocolate", "Coral", "CornflowerBlue", "Cornsilk", "Crimson", "Cyan",
				"DarkBlue", "DarkCyan", "DarkGoldenRod", "DarkGray", "DarkGreen", "DarkGrey",
				"DarkKhaki", "DarkMagenta", "DarkOliveGreen", "DarkOrange", "DarkOrchid", "DarkRed",
				"DarkSalmon", "DarkSeaGreen", "DarkSlateBlue", "DarkSlateGray", "DarkSlateGrey",
				"DarkTurquoise", "DarkViolet", "DeepPink", "DeepSkyBlue", "DimGray", "DimGrey",
				"DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen", "Fuchsia", "Gainsboro",
				"GhostWhite", "Gold", "GoldenRod", "Gray", "Green", "GreenYellow", "Grey", "HoneyDew",
				"HotPink", "IndianRed", "Indigo", "Ivory", "Khaki", "Lavender", "LavenderBlush",
				"LawnGreen", "LemonChiffon", "LightBlue", "LightCoral", "LightCyan",
				"LightGoldenRodYellow", "LightGray", "LightGreen", "LightGrey", "LightPink",
				"LightSalmon", "LightSeaGreen", "LightSkyBlue", "LightSlateGray", "LightSlateGrey",
				"LightSteelBlue", "LightYellow", "Lime", "LimeGreen", "Linen", "Magenta", "Maroon",
				"MediumAquaMarine", "MediumBlue", "MediumOrchid", "MediumPurple", "MediumSeaGreen",
				"MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise", "MediumVioletRed",
				"MidnightBlue", "MintCream", "MistyRose", "Moccasin", "NavajoWhite", "Navy", "OldLace",
				"Olive", "OliveDrab", "Orange", "OrangeRed", "Orchid", "PaleGoldenRod", "PaleGreen",
				"PaleTurquoise", "PaleVioletRed", "PapayaWhip", "PeachPuff", "Peru", "Pink", "Plum",
				"PowderBlue", "Purple", "RebeccaPurple", "Red", "RosyBrown", "RoyalBlue",
				"SaddleBrown", "Salmon", "SandyBrown", "SeaGreen", "SeaShell", "Sienna", "Silver",
				"SkyBlue", "SlateBlue", "SlateGray", "SlateGrey", "Snow", "SpringGreen", "SteelBlue",
				"Tan", "Teal", "Thistle", "Tomato", "Turquoise", "Violet", "Wheat", "White",
				"WhiteSmoke", "Yellow", "YellowGreen",],

 



##Notes:
 
        The colors in my example are listed at:
##     W3 Schools / HTML Color Names

0 Likes

Add custom html tags to autocomplete
#7

This is it! soo cool :slight_smile:

1 Like