Does APNG support frame-based palettes or only a global palette? - png

I'm having a hard time understanding how palette information is handled in APNG animations that use type PNG_COLOR_TYPE_PALETTE because, apparently, there is little to no documentation.
All PNG_COLOR_TYPE_PALETTE test animation files that I have have just a single PLTE chunk; i.e., all frames share the same global palette. Is this a limitation of the APNG file format; or, can frames also use individual palettes as is possible with GIF, for example? If that is possible, where should the frame-based PLTE chunks go?
Thanks!

To validate your answer:
"[The frame data chunk] utilizes the same bit depth, color type, compression method, filter method, interlace method, and palette (if any) as the default image." [https://wiki.mozilla.org/APNG_Specification#.60fdAT.60:_The_Frame_Data_Chunk]

To answer my own question, I've tried several tools which convert GIFs to APNG and when I use them with multi-palette GIFs those tools always remap the frame pixels to one global palette so I guess APNG doesn't support multiple palettes but just a single global palette shared by all frames.

Related

How can I get colored output in VS Code output window?

This is really a two part question, but they are in the same vein, so I will ask in one post.
When I flip through various colors, I see that they also have the ability to change the color of the Output window. Which VS Code setting can I use to change the color of this output? To be specific, I am not asking about the terminal, I am inquiring about the output window that displays the output when using coderunner as an example. Please refer to the screenshot to see which window I am referring to.
Second question is I can see that the output does support multiple colors. I am trying to use the module cpprint from the python lib prettyprinter to print colored output to this window. When I run the script in a terminal, I am getting colors, but in the output window, I am not getting any colors. Will it be possible for me to get similar colored output in the output window as in the terminal? I am assuming the output window supports colors because the [Running]... and end are in colors.
The Python lib I was referring to
Thanks!
So, for long while now, we have had to resort to an IBM developed extension named Output Colorizer, however, this extension clashed with other extensions, and cuased an array of bugs/issues. I personally had to disable it because it was causing text to not print at all in my output window.
We now have a much more robust, built-in solution, and it doesn't require doing anything.
Visual Studio Code added syntax-highlighting support to the "Output Channel" as part of a Milestone that it had been working on, in its March 2022 Release.
The syntax highlighting is configured by a specified languages grammar.
The language grammar that is used will vary, depending on which output channel you use. The person who decided on the language syntax highlighting used for any given output-channel is the person who authored the extension that the output-channel belongs too.
Here is the link to the official release note
Because the output highlights syntax on a language basis, configuring what colors the new feature uses to color any given text, is done the same way you color syntax.
In Depth Explanation:
If numbers are set by your theme to render green (#00FF00), then, then numbers that are printed in the Output View Panel will also be green.
If the language defined constants true & false render as a pastel-red (#FF7799) when you are writing TypeScript, but when you have a Java file open, they render as a bright pastel-yellow-green (#BBEE88), then the way they render will be contingent on whether or not the output window was set to Java or TypeScript. Obviously an output window for an extension that's a tool for Java, will most likely highlight syntax as Java. A typescript-tool extension will likely highlight all syntax as if it were typescript.
Some People Might Prefer that the Feature be more Customizable
Some people might want a more customizable feature, but I think it would be a mistake, even if it were possible, to highlight the syntax in the output differently from the editor. In fact, thinking about it, it would be stupid to have done that. It makes perfect sense that it is the way it is.
Anyways, that is the end of the Color in the Output Channel, or at-least for now.

command line drawing unicode boxes for a graph

I don't know what the correct keywords are for what I am trying to achieve.
I have rainbarf for tmux which AFAIK is written in Perl.
I am wondering if there is some library, extension or functionality in node.js which would enable me to draw bars like the ones rainbarf draws, in order to write tmux monitors (wifi, GPU usage, etc).
Edit
I think that the correct term is unicode boxes as I have finally found a page that documents them.
They seem to be unicode geometric shapes So I am guessing that correctly printing them to screen (assuming the terminal supports them) should achieve the same result?
They appear to be small pixel-sized boxes constrained by the size of a font.
rainbarf is inspired on spark. There are several implementations of spark in JavaScript (and also other languages), check here: https://github.com/holman/spark/wiki/Alternative-Implementations
I found the answer to my question.
This is not related to Node.JS and is in fact simple unicode character printing.
The above picture simply prints a sequence of those characters in a sequence:
'\u2581','\u2582','\u2583','\u2584',
'\u2585','\u2586','\u2587','\u2588'
This in effect produces the "unicode" graph.
It is not language specific, but the colors are.

How are conflicting faces orders resolved?

(I don't know if the title of this question is correct)
When using several minor modes simultaneously changing 'colors', what determines in which order which modes shows what? For example I'm trying to use both highlight-changes-mode and rainbow-mode: http://julien.danjou.info/projects/emacs-packages
The problem I have is that when I enter a new color in my buffer (say #306090), instead of seeing the background color of the #306090 characters as rainbow-mode would want it to be, I see the background color (of the entire line) as changed (because I'm using highlight-changes-mode, which I like a lot).
My question is kinda a generic one: what determines in which "order" conflicts are resolved here? Does it depend on the loading order of the various modes?
It doesn't depend on the loading order of the modes. It depends on the respective mechanisms the modes use to apply the faces.
rainbow-mode uses font-lock to highlight text, which in turn uses so-called text properties. Text properties are intrinsic properties of string objects, and can belong to string objects that are not part of any buffer. (Text properties thus survive cutting and pasting, for example.)
highlight-changes-mode, in contrast, uses "overlays," which can be thought of as virtual text properties: An overlay is a specification of an interval in a buffer together with a specification of one or more properties that that interval should act as if it had; among the properties that an overlay can specify is a face. Overlay properties are not properties of the strings themselves (and so don't survive cutting and pasting).
If incompatible face attributes are specified by the text property of a buffer substring and an overlay covering that substring, then the overlay takes precedence. (If the face attributes aren't incompatible--as when a text property specifies a foreground color but no background color, and an overlay specifies merely a background color--then they're merged in the fashion you'd expect.)
In general the rules for merging faces are complex, because overlays themselves can specify strings to display at a buffer position, which strings in turn can have their own text properties, and different rules govern such cases; also, certain built-in faces like mouse highlights and mode-line faces are governed by their own rules. If you want to know more, see the info nodes "(elisp) Faces" and "(elisp) Overlays". For the complete story you'll need to look at the source code of the display routine (probably starting with handle_face_prop in xdisp.c and face_at_string_position in xfaces.c).

Code chunk fontification in Emacs noweb mode?

In noweb mode, I would like to make the doc chunks and code chunks easier to distinguish. I'm already using font-lock-mode, but it applies the same face to strings in R and strings in tex, so doesn't distinguish the code and doc chunks very well.
For example, a slightly different background color for the code chunks.
One possibility would be to define a new face for the minor mode of the code chunk, but then that face would also apply when editing a buffer in that mode.
Another possibility would be to create an overlay for the code chunks.
Also, somewhat related, org-mode can be configured to use different background colors for source blocks.
Update: I now use polymode to achive this.
You can use noweb-font-lock-mode from ESS to get syntax highlighting for both code and documentation chunks. I'd recommend you also use noweb-mode from ESS too, because it has some improvements.
One option would be mmm-mode, with which you can define regions that are in a different mode -- it also applies a face to the entire sub-mode region, which you can use to easily distinguish those regions within the parent file.
I personally use this for Ruby within IRB, Javascript and CSS within HTML etc. There's an example for javascript in my emacs config.
The MuMaMo extensions allows different rules for different parts of the file. Getting the nXhtml package will give you the mode and I think you can configure it to do what you want.

Text editor with autocomplete while typing normal text

There's a lot of Text editors which support autocomplete during programming, but I want one which can autocomplete while typing normal text as I see a lot of repetition of words I type. Any emacs fans who have implemented this ?
Try the builtin dabbrev-expand; it's bound to M-/.
Also see Predictive Mode if you fancy the more flashy stuff.
pabbrev-mode (predictive abbreviation) works by examining previously written text. Unlike dynamic abbreviation, the text is analyzed during idle time (which enables quick lookup of potential abbreviations). Pabbrev looks at word frequency to suggest the most common expression.
From the documentation, this is what it might look like as you typed the keys pred.
p[oint]
pr[ogn]
pre[-command-hook]
pred[ictive]
I love hippie-expand!
The Zeus editor has a non-programming auto complete feature (i.e. Alt + Space) that takes the current user input, searches the current file for words starting with that input and displays them in a drop down list.
vim has such a feature http://vim.wikia.com/wiki/VimTip4
i think ultra edit has a simmilar feature
You could set up auto-complete mode with a dictionary as your source. I have been very tempted to do this myself.
predictive-mode auto-completes from a dictionary of words. It learns which words you use most often, and can also automatically learn new words as you type if desired.
It's very fast, fast enough that turning on auto-completion doesn't cause any noticeable lag when typing, even with a large dictionary.
(Disclaimer: I'm the author of predictive-mode)