What does <color indexed="81"> mean? - colors

I have a document created by Excel 2007:
<fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4506" codeName="{B7FE6334-C1A2-E50D-BD3D-5F4D41BBC2E3}"/>
... which contains the following color in a font definition in xl/styles.xml:
<color indexed="81"/>
I understand from the ECMA standard that this colour index refers to the <indexedColors> collection in xl/styles.xml if there is such a collection, otherwise it refers to the default palette shown in the standard. My problem is that this document contains no <indexedColors> element, and the default palette only has 66 entries, so I do not know what 81 refers to. Does anybody else?
Interestingly a google search for color indexed="81" returns some sample OpenXML snippets containing the same thing, but alas no explanation.

MSDN Documentation specifies the indexed property of class Color in OpenXML as:
Indexed color value. Only used for backwards compatibility. References a color in indexedColors.
The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.
It is part of the larger DocumentFormat.OpenXml.Spreadsheet namespace.
The file you're describing was built via source code which contained the 81 value. It probably looked something like this Java code, defining a Color() instance with 81U from an unrelated color index.
If you're needing to find out why, I'd create an account at MSDN and reply to Jack9999's post with an inquiry as to why he used that value. I'm guessing it's a bug on his part, being familiar with a separate and possibly JAVA-related color index.
Excel--not recognizing it--is just using their default comment color values.
Cheers

Index 0x51 is the system tooltip text color. (i.e. ::GetSysColor(COLOR_INFOTEXT) ).

NECRO answer:
From Vincent Tan's SpreadsheetOpenXmlFromScratch:
For colours, if you're dealing with the DocumentFormat.OpenXml.Color class,
there are 3 ways of setting the colour value:
Indexed colour
RGB colour
Themed colour
There's a property called Auto of the Color class. I didn't find a use for it, and you can probably ignore it. Excel won't choke on errors if you don't set it in any caseā€¦
Indexed colours are for backwards compatibility, so I'm not going to teach you how. Basically it's an index value to the palette of colours stored within the spreadsheet's stylesheet. We'll deal with the Stylesheet class in the next chapter. You can explore the IndexedColors class on your own, which is a child class of the Colors class, which is in turn a child class of Stylesheet.

Related

How to change button layout and position in Threepenny GUI?

How do I change the size and position of buttons or other UI elements in a GUI created with the threepenny-gui package?
The documentation of Graphics.UI.Threepenny.Attributes lists some functions which are probably useful, such as coords :: WriteAttr Element String. However, I don't understand how to use them. Specifically, I don't understand what the String argument is supposed to be.
Thanks
I think my misunderstanding that I had was that my problem was not actually related to threepenny-gui but is instead a question about HTML. This link helped my find the answer I was looking for: https://www.geeksforgeeks.org/html-attributes/
Just in case anyone else is struggling with this as well, this line (mostly) solves it:
# set UI.style [("text-align", "center"),("color","red"),("font-size","30px")]
(The UI in UI.style comes from: import qualified Graphics.UI.Threepenny as UI)
Threepenny UI element combinators translate more or less directly to HTML, and so you should think in terms of HTML when doing layout with it:
The attributes from Graphics.UI.Threepenny.Attributes you mention are HTML attributes. Modifying them while defining your initial layout is typically done with set. (By the way, if you need a reference for looking up what things like HTML attributes do, you can't do wrong with MDN.)
For CSS styling, you can use the (#.) combinator.
As for layout, the basic tools are (#+) to nest HTML elements, and grid, row and column to arrange div-based grids.

Add svg attributes in diagrams

I would like to add tooltips (or hovering behavior) on SVG diagrams generated by diagrams.
Is there a way to add custom properties to a diagram , or worst comes to the worst be able to set and id to things, so they can be referred to in Javascript.
The question is slightly misleading because the title property that gives tooltips on SVGs in browsers is not an attribute, but an element of its own. You add tooltips, that is SVG titles, with the method svgTitle in Diagrams.Backend.SVG.
The same module also contains methods svgID and svgClass to add these attributes to allow external javascript to find specific SVG elements.
I kept googling, and havn't tried it yet, but I found this. It seems to exist to exactly satisfy your need.
It is SVG backend only.

Orchard CMS: Add a stylesheet to a page

Setup:
I am using Orchard CMS 1.6.
I have a site where I need to be able to set the background color of the whole page. Ie, I need to style the body tag.
I could use the LayoutSelector module and have distinct layouts. However, the only difference in each layout is that the background-color rule for the body tag is different. So it seems a very un-dry way of doing things.
I can't find any way to make Vandelay.Classy add a distinct id or class to the body tag (it adds, as I understand it) an id or a class to the outer tag of a content type. In my case, that isn't the body tag.
So that is no good, I really do need to customize the body tag.
How to do this?
Note:
I need 3 different background colors. I also have a two column layout and a three column layout. [I use (a modified version of) the layoutSelector module to achieve this.] So to have 3 different colors of background, and I used layouts to achieve this, I would need 6 different layouts: TOTAL overkill.
There must be a better way...
From any cshtml file, you should be able to access the Layout shape. From pretty much anywhere else, you can still get to the Layout shape through WorkContextAccessor. Once you have a reference to the Layout shape, you can do Layout.Classes.Add("the-class-you-want").

How to get the effect of 'user-select: text' in css3?

The validator at http://jigsaw.w3.org/css-validator/ says that the value 'text' for 'user-select' is not valid. For a css rule with this code in it:
user-select: text;
the validator says:
text is not a user-select value : text text
Presumably this is because of this behavior, specified at (the outdated) http://www.w3.org/TR/2000/WD-css3-userint-20000216#user-select:
This property is not inherited, but it does affect children in the
same way that display: none does, it limits it. That is if an element
is user-select: none, it doesn't matter what the user-select value is
of its children, the element's contents or it's childrens contents
cannot be selected.
Also, I only see the attribute value 'text' specified in that out-of-date css3 doc from w3.org:
http://www.w3.org/TR/2000/WD-css3-userint-20000216#user-select
and not in the latest one: http://www.w3.org/TR/css3-ui/
Additionally, searching 'whatwg.org' yields nothing.
Any ideas if 'user-select: text' is valid css3, and if not, what should be used instead?
This would be used, for example, when overriding 'user-select: none' rules applied to containers of text and ancestor containers.
You are getting this wrong. user-select:text doesn't mean it would select text only. It's default value of user-select property. W3C describe it this way:
The element's contents follow a standard text content selection model.
And Also MDN syas something same:
-moz-none The text of the element and sub-elements cannot be selected,
but selection can be enabled on sub-elements using
-moz-user-select:text .
So I don't think this should prevent selecting images or boxes.
As far as I know user-select:text is useful when you have user-select:none for most or all of your elements and you have a textbox or text area that is kind of output and you want it be selectable for copying and pasting.
It seems if you use -webkit- prefix it works for me. I'm sure it works with -moz- prefix too. Test this fiddle in your browser. I don't know why user-select:text is not working on my Chrome 13 Mac?

Making new colors in JExcelApi

I'm using JExcelApi for generating XLS files. From jxl.format.Colour, I see how to get any of the colors in the "standard Excel colour palette", but not how to create a new color (say, given its RGB).
But in Excel itself, I can pick any color at all.
Am I just missing it? Is there a way in JExcelApi to select an arbitrary color? I'm using a simple find-the-closest-standard-color method right now, which is OK but not great.
The way to override a palette index in JExcel API is to use the method [setColourRGB][1] on the writable workbook. For instance:
myWorkbook.setColourRGB(Colour.LIGHT_TURQUOISE2, 14, 67, 89);
if you want to change the color value in the palette entry where there is by default the second light turquoise. Or, more easily in some cases, directly with the palette index:
myWorkbook.setColourRGB(Colour.getInternalColour(myPaletteIdx), 14, 67, 89);
A small update: only the indexes from 8 to 64 can be customized according to a comment inside the source code of jxl.biff.PaletteRecord.
[1]: http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/write/WritableWorkbook.html#setColourRGB(jxl.format.Colour, int, int, int)
Excel versions before 2007 have a standard palette, and given that the API you are using does not support the 2007 format, you may be stuck with that. The reason you can choose any colour you want is probably because you are using a new version of Excel.
See this information on the Microsoft site.
I don't see how you could override the standard colour palette in the API you are using, but in Apache POI (which also lets you write Excel files) you can: see this link. Basically, what you need to do there is: assign certain standard colours (green, etc) to your cells; then override these colours with whatever custom colour you need.
WritableCellFormat cellFormat = new WritableCellFormat();
Colour customColor = new Colour(10000, "1", 255, 0, 0){
};
cellFormat.setBackground(customColor);
writableCell.setCellFormat(cellFormat);

Resources