summaryrefslogtreecommitdiff
path: root/stand/lua/color.lua
AgeCommit message (Collapse)Author
2023-08-16Remove $FreeBSD$: two-line lua tagWarner Losh
Remove /^--\n--\s*\$FreeBSD\$.*$\n/
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2021-01-02loader: implement framebuffer consoleToomas Soome
Draw console on efi. Add vbe framebuffer for BIOS loader (vbe off, vbe on, vbe list, vbe set xxx). autoload font (/boot/fonts) based on resolution and font size. Add command loadfont (set font by file) and variable screen.font (set font by size). Pass loaded font to kernel. Export variables: screen.height screen.width screen.depth Add gfx primitives to draw the screen and put png image on the screen. Rework menu draw to iterate list of consoles to enamble device specific output. Probably something else I forgot... Relnotes: yes Differential Revision: https://reviews.freebsd.org/D27420
2019-10-21lualoader: fix setting of loader_color=NO in loader.conf(5)Kyle Evans
Previously color.disabled would be calculated at color module load time, then never touched again. We can detect serial boots beyond just what we're told by loader.conf(5) so this works out in many cases, but we must re-evaluate the situation after the config is loaded to make sure we're not supposed to be forcing it enabled/disabled. Discovered while trying to test r353872. Notes: svn path=/head/; revision=353873
2019-10-21lualoader: don't botch disabling of colorKyle Evans
When colors are disabled, color.escape{fg,bg} would return the passed in color rather than the proper ANSI sequence for the color. color.escape{fg,bg} would be wrong. Instead return '', as the associated reset* functions will also return ''. This should get rid of the funky '2' and '4' in the kernel selector if you're booting serial. Reported by: npn Notes: svn path=/head/; revision=353872
2019-09-22loader_lua: lua color changes should end with resetToomas Soome
The color change should have reset sequence, not switch to white. Notes: svn path=/head/; revision=352601
2019-09-20loader: Respect loader_color=YES for serial consolesKyle Evans
It's not uncommon these days for the terminals attached to serial consoles to support ANSI escape sequences. However, we assume escape sequences may break some serial consoles and default to not using them when boot_serial or boot_multicons (or if console contains "comconsole" in the forth loader) for broader compatibility. We also have loader_color which can be explicitly set to "NO" to disable the use of ANSI escape sequences. The problem is that loader_color=YES gets ignored when boot_serial=YES or boot_multicons=YES (or when console contains "comconsole" in the forth loader). To fix, the existing default behavior remains unchanged when loader_color is unset, loader_color=NO explicitly disables the use of ANSI escape sequences still, and the change is that loader_color=YES can now be used to explicitly allow ANSI escapes when a serial console is enabled. Submitted by: Ryan Moeller <ryan@ixsystems.com> Reviewed by: tsoome (forth), kevans (lua) MFC after: 1 week Sponsored by: iXsystems, Inc. (Ryan) Differential Revision: https://reviews.freebsd.org/D21732 Notes: svn path=/head/; revision=352559
2018-06-12lualoader: More black-on-white fixesKyle Evans
To recap the problem: with a black-on-white xterm, the menu draws terribly. Ideally, we would try our best for a white-on-black context for the menu since graphics and whatnot might not be tested for other setups and there's no reasonable way to sample the terminal at this point for the used color scheme. This commit attempts to address that further in two ways: - Instead of issuing CSI bg/fg resets (CSI 39m and CSI 49m respectively for "default"), issue CSI bg/fg escape sequences for our expected color scheme - Reset to *our* default color scheme before we even attempt to load the local module, so that we personally don't have any earlier text with the console default color scheme. Reported by: emaste (again) Notes: svn path=/head/; revision=334986
2018-03-21lualoader: Clear up some possible naming confusionKyle Evans
In the original lualoader project, 'escapef' and 'escapeb' were chosen for 'escape fg' and 'escape bg'. We've carried on this naming convention, and as our use of attributes grow the likeliness of 'escapeb'/'resetb' being confused upon glance for 'escape bold'/'reset bold' increases. Fix this by renaming these four functions to {escape,reset}{fg,bg} rather than {escape,reset}{f,b} for clarity. Reported by: dteske Notes: svn path=/head/; revision=331304
2018-03-20lualoader: Use less atomic options for resetting colors/attributesKyle Evans
Noted by dteske: CSI 1m ... CSI 22m CSI 2m ... CSI 22m CSI 4m ... CSI 24m CSI 5m ... CSI 25m CSI 7m ... CSI 27m CSI 8m ... CSI 28m CSI (30-37)m ... CSI 39m CSI (40-47)m ... CSI 49m - Provide resetf/resetb to match escapef/escapeb - Use CSI 22m to undo a bold This is a more reasonable approach than what was previously taken. Reported by: dteske Notes: svn path=/head/; revision=331259
2018-03-20lualoader: Reset attributes and color scheme with color.highlight()Kyle Evans
Previously, we sent a CSI 0m sequence to reset attributes, which also reset the color scheme if the terminal defaults didn't match what we're expecting. Go all-in and reset the color scheme, too, just in case. Reported by: emaste Notes: svn path=/head/; revision=331257
2018-03-19lualoader: Setup default color scheme if we're using colorsKyle Evans
The console may have been set for different colors before lualoader kicks in; notably, a black-on-white color scheme is not necessarily what we're expecting. While here, make color.default() a composition of color.escape() instead of rewriting the escape sequence to make it more obvious what it's achieving: a white-on-black color scheme with no attributes set. Reported by: emaste, whose eyes may rest easily Notes: svn path=/head/; revision=331211
2018-02-27lualoader: Convert instances of KEYSTR_ESCAPE .. "[" -> KEYSTR_CSIKyle Evans
Notes: svn path=/head/; revision=330087
2018-02-27lualoader: Replace instances of \027 with KEYSTR_ESCAPEKyle Evans
With exception to drawing bits, which should probably be kept as-is to not make a mess out of things. Reported by: rpokala (a while ago) Notes: svn path=/head/; revision=330084
2018-02-26lualoader: More argument name expansion, part 2Kyle Evans
screen also has some instances, but it also has other cleanup to go with it. Because of this, I will be committing the screen changes separately. Notes: svn path=/head/; revision=330009
2018-02-23Add SPDX tags to lua filesKyle Evans
Notes: svn path=/head/; revision=329851
2018-02-21lualoader: Drop excessive parenthesizingKyle Evans
This was also a convenience convention (for me) that is not very lua-tic. Drop it. I've maintained some parentheses where I'd prefer them, for example, 'if x or y or (z and w) then', but these situations are far and few between. Notes: svn path=/head/; revision=329685
2018-02-21lualoader: Drop terminating semicolonsKyle Evans
This was previously chosen out of convenience, as we had a mixed style and needed to be consistent. I started learning Lua on Friday, so I switched everything over. It is not a very lua-nic convention, though, so drop it. Excessive parenthesizing around conditionals is next on the chopping block. Notes: svn path=/head/; revision=329684
2018-02-20stand/lua: Consistently organize modulesKyle Evans
We follow pretty closely the following structure of a module: 1. Copyright notice 2. Module requires 3. Module local declarations 4. Module local definitions 5. Module exports 6. return Re-organize the one-offs (config/drawer) and denote the start of module exports with a comment. Notes: svn path=/head/; revision=329641
2018-02-19stand/lua: Round up some more style.lua(9) concernsKyle Evans
Notes: svn path=/head/; revision=329594
2018-02-19stand/lua: Rename bootserial for clarityKyle Evans
Notes: svn path=/head/; revision=329577
2018-02-17stand/lua: Style passKyle Evans
These are the style points that I'd like to try and maintain in our lua scripts: - Parentheses around conditionals - Trailing semicolons, except on block terminators - s:method(...) instead of string.method(s, ...) where applicable There's likely more, but that'll get hammered out as we continue. Notes: svn path=/head/; revision=329435
2018-02-12Add the lua scripts from the lua-bootloader SoCWarner Losh
These are the .lua files from from Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur and Wojciech A. Koszek also contributed. Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader Sponsored by: Google Summer of Code Improve the SoC lua menu code to bring it in line with forth menu functionality Submitted by: Zakary Nafziger Sponsored by: FreeBSD Foundation Use loader.setenv and loader.unsetenv instead of loader.perform Convert from include("/boot/foo.lua") to foo = require("foo"); to bring in line with latest lua module conventions. Enforce a uniform style for the new .lua files: o hard tab indenation for 8 spaces o don't have if foo then bar; else bas; end on one line MFC After: 1 month Relnotes: yes Differential Review: https://reviews.freebsd.org/D14295 Notes: svn path=/head/; revision=329167