diff --git a/stand/lua/Makefile b/stand/lua/Makefile --- a/stand/lua/Makefile +++ b/stand/lua/Makefile @@ -27,6 +27,10 @@ gfx-orbbw.lua \ menu.lua \ password.lua \ - screen.lua + screen.lua \ + gfx-fork.lua gfx-forward.lua gfx-space.lua gfx-speedy.lua + + +SUBDIR+= brand logo .include diff --git a/stand/lua/brand/Makefile b/stand/lua/brand/Makefile new file mode 100644 --- /dev/null +++ b/stand/lua/brand/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +.include + + + +FILESDIR= /boot/lua/brand + +FILES+= brand-art.lua brand-bs3d.lua brand-cube.lua brand-fluffy.lua brand-neon.lua brand-square.lua brand-subtle.lua brand-train.lua brand-zigzag.lua + + + + + + +.include diff --git a/stand/lua/brand/brand-art.lua b/stand/lua/brand/brand-art.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-art.lua @@ -0,0 +1,122 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " ________ ______ ______ ______" , + " |_ __ | |_ _ \\.' ____ |_ _ `." , + " | |_ \\_ .--..---..---. | |_) | (___ \\_|| | `. \\" , + " | _|[ `/'`/ /__/ /__\\\\| __'._.____`. | | | |" , + " _| |_ | | | \\__| \\__._| |__)| \\____) _| |_.' /" , + " |_____|[___] '.__.'.__|_______/\\______|______.'" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local art_graphic_func = function() + return { + " ________ ______ ______ ______", + " |_ __ | |_ _ \\.' ____ |_ _ `.", + " | |_ \\_ .--..---..---. | |_) | (___ \\_|| | `. \\", + " | _|[ `/'`/ /__/ /__\\\\| __'._.____`. | | | |", + " _| |_ | | | \\__| \\__._| |__)| \\____) _| |_.' /", + color.highlight(color.escapefg(color.getTheme(color.BRAND)) .." |_____|[___] '.__.'.__|_______/\\______|______.'" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = art_graphic_func(), + -- shift = {x = 0, y = 1 }, + + } + } diff --git a/stand/lua/brand/brand-bs3d.lua b/stand/lua/brand/brand-bs3d.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-bs3d.lua @@ -0,0 +1,123 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + + ",------. ,-----. ,---. ,------." , + "| .---',--.--. ,---. ,---. | |) /_ ' .-' | .-. \\" , + "| `--, | .--'| .-. :| .-. :| .-. \\`. `-. | | \\ :" , + "| |` | | \\ --.\\ --.| '--' /.-' || '--' /" , + "`--' `--' `----' `----'`------' `-----' `-------'" .. , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local bs3d_graphic_func = function() + return { + " ____ ____ ____ ____", + "/\\ _`\\ /\\ _`\\ /\\ _`\\ /\\ _`\\", + "\\ \\ \\L\\_\\ _ __ __ __ \\ \\ \\L\\ \\\\ \\,\\L\\_\\\\ \\ \\/\\ \\", + " \\ \\ _\\//\\`'__\\/'__`\\ /'__`\\\\ \\ _ <'\\/_\\__ \\ \\ \\ \\ \\ \\", + " \\ \\ \\/ \\ \\ \\//\\ __/ /\\ __/ \\ \\ \\L\\ \\ /\\ \\L\\ \\\\ \\ \\_\\ \\", + " \\ \\_\\ \\ \\_\\\\ \\____\\\\ \\____\\ \\ \\____/ \\ `\\____\\\\ \\____/", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .." \\/_/ \\/_/ \\/____/ \\/____/ \\/___/ \\/_____/ \\/___/" .. color.resetfg()) , + } +end + + +return { + brand = { + graphic = bs3d_graphic_func(), + -- shift = {x = 0, y = 1 }, + + } + } diff --git a/stand/lua/brand/brand-cube.lua b/stand/lua/brand/brand-cube.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-cube.lua @@ -0,0 +1,123 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " ______ ____ _____ ____", + " / ____/_____ ___ ___ / __ )/ ___/ / __ \\", + " / /_ / ___// _ \\ / _ \\ / __ |\\__ \\ / / / /", + " / __/ / / / __// __// /_/ /___/ // /_/ /", + " /_/ /_/ \\___/ \\___//_____//____//_____/" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local cube_graphic_func = function() + return { + + + " ______ ______ ______ ______ ______ ______ _____", + "/\\ ___/\\ == \\/\\ ___\\/\\ ___\\/\\ == \\/\\ ___\\/\\ __-.", + "\\ \\ __\\ \\ __<\\ \\ __\\\\ \\ __\\\\ \\ __<\\ \\___ \\ \\ \\/\\ \\", + " \\ \\_\\ \\ \\_\\ \\_\\ \\_____\\ \\_____\\ \\_____\\/\\_____\\ \\____-", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .." \\/_/ \\/_/ /_/\\/_____/\\/_____/\\/_____/\\/_____/\\/____/" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = cube_graphic_func(), + -- shift = {x = 0, y = 1 }, + + + } + } diff --git a/stand/lua/brand/brand-fluffy.lua b/stand/lua/brand/brand-fluffy.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-fluffy.lua @@ -0,0 +1,121 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + + ",------. ,-----. ,---. ,------." , + "| .---',--.--. ,---. ,---. | |) /_ ' .-' | .-. \\" , + "| `--, | .--'| .-. :| .-. :| .-. \\`. `-. | | \\ :" , + "| |` | | \\ --.\\ --.| '--' /.-' || '--' /" , + "`--' `--' `----' `----'`------' `-----' `-------'" .. , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local fluffy_graphic_func = function() + return { + ",------. ,-----. ,---. ,------.", + "| .---',--.--. ,---. ,---. | |) /_ ' .-' | .-. \\", + "| `--, | .--'| .-. :| .-. :| .-. \\`. `-. | | \\ :", + "| |` | | \\ --.\\ --.| '--' /.-' || '--' /", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .. "`--' `--' `----' `----'`------' `-----' `-------'" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = fluffy_graphic_func(), + -- shift = {x = 0, y = 1 }, + + } + } diff --git a/stand/lua/brand/brand-neon.lua b/stand/lua/brand/brand-neon.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-neon.lua @@ -0,0 +1,122 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ +" _______ ______ _ _____" , +"(_______) (____ \\ | | (____ \\" , +" _____ ____ ____ ____ ____) ) \\ \\ _ \\ \\" , +"| ___) ___) _ ) _ ) __ ( \\ \\| | | |" , +"| | | | ( (/ ( (/ /| |__) )____) ) |__/ /" , +"|_| |_| \\____)____)______(______/|_____/" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local neon_graphic_func = function() + return { + " _______ ______ _ _____", + "(_______) (____ \\ | | (____ \\", + " _____ ____ ____ ____ ____) ) \\ \\ _ \\ \\", + "| ___) ___) _ ) _ ) __ ( \\ \\| | | |", + "| | | | ( (/ ( (/ /| |__) )____) ) |__/ /", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .."|_| |_| \\____)____)______(______/|_____/" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = neon_graphic_func(), + -- shift = {x = 0, y = 1 }, + + } + } diff --git a/stand/lua/brand/brand-square.lua b/stand/lua/brand/brand-square.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-square.lua @@ -0,0 +1,120 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " ______ ____ _____ ____", + " / ____/_____ ___ ___ / __ )/ ___/ / __ \\", + " / /_ / ___// _ \\ / _ \\ / __ |\\__ \\ / / / /", + " / __/ / / / __// __// /_/ /___/ // /_/ /", + " /_/ /_/ \\___/ \\___//_____//____//_____/" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local square_graphic_func = function() + return { + " ______ ______ ______ ______ ______ ______ _____", + "/\\ ___\\/\\ == \\ /\\ ___\\ /\\ ___\\ /\\ == \\ /\\ ___\\ /\\ __-.", + "\\ \\ __\\\\ \\ __< \\ \\ __\\ \\ \\ __\\ \\ \\ __< \\ \\___ \\\\ \\ \\/\\ \\", + " \\ \\_\\ \\ \\_\\ \\_\\\\ \\_____\\\\ \\_____\\\\ \\_____\\\\/\\_____\\\\ \\____-", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .. " \\/_/ \\/_/ /_/ \\/_____/ \\/_____/ \\/_____/ \\/_____/ \\/____/" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = square_graphic_func(), + -- shift = {x = 0, y = 0 }, + + } + } diff --git a/stand/lua/brand/brand-subtle.lua b/stand/lua/brand/brand-subtle.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-subtle.lua @@ -0,0 +1,119 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " ______ ____ _____ ____", + " / ____/_____ ___ ___ / __ )/ ___/ / __ \\", + " / /_ / ___// _ \\ / _ \\ / __ |\\__ \\ / / / /", + " / __/ / / / __// __// /_/ /___/ // /_/ /", + " /_/ /_/ \\___/ \\___//_____//____//_____/" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local subtle_graphic_func = function() + return { + " ____| __ ) ___| __ \\", + " | __| _ \\ _ \\ __ \\ \\___ \\ | |", + " __| | __/ __/ | | | | |", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .. "_| _| \\___| \\___| ____/ _____/ ____/" .. color.resetfg() ), } +end + + +return { + brand = { + graphic = subtle_graphic_func(), + -- shift = {x = 0, y = 0 }, + + } + } + diff --git a/stand/lua/brand/brand-train.lua b/stand/lua/brand/brand-train.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-train.lua @@ -0,0 +1,121 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " ______ ____ _____ ____", + " / ____/_____ ___ ___ / __ )/ ___/ / __ \\", + " / /_ / ___// _ \\ / _ \\ / __ |\\__ \\ / / / /", + " / __/ / / / __// __// /_/ /___/ // /_/ /", + " /_/ /_/ \\___/ \\___//_____//____//_____/" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local train_graphic_func = function() + return { + " ___ ___ ___ ___", + " | __| _ _ ___ ___ | _ ) / __| | \\", + " | _| | '_| / -_) / -_) | _ \\ \\__ \\ | |) |", + " _|_|_ _|_|_ \\___| \\___| |___/ |___/ |___/", + color.highlight(color.escapefg(color.getTheme(color.BRAND)) .."_| *** |_|*****|_|*****|_|*****|_|*****|_|*****|_|*****|".. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.BRAND)) .."*`-0-0-'*`-0-0-'*`-0-0-'*`-0-0-'*`-0-0-'*`-0-0-'*`-0-0-'" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = train_graphic_func(), + -- shift = {x = 0, y = 0 }, + + } + } diff --git a/stand/lua/brand/brand-zigzag.lua b/stand/lua/brand/brand-zigzag.lua new file mode 100644 --- /dev/null +++ b/stand/lua/brand/brand-zigzag.lua @@ -0,0 +1,125 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " ______ ____ _____ ____", + " / ____/_____ ___ ___ / __ )/ ___/ / __ \\", + " / /_ / ___// _ \\ / _ \\ / __ |\\__ \\ / / / /", + " / __/ / / / __// __// /_/ /___/ // /_/ /", + " /_/ /_/ \\___/ \\___//_____//____//_____/" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local zigzag_graphic_func = function() + return { + " _______________ _______________ ___________", + "(_ ____( __ \\/ __/ ___(_ _ \\/ ___(_ __ \\", + " ) (___ ) (__)( (_( (__ ) (_)( (___ ) ) \\ \\", + " ( ___)( __/) __) __) \\ _/\\___ \\( ( ) )", + " ) ( ) \\ \\ ( ( ( ( / _ \\ ) )) ) ) )", + " ( ) ( ( \\ \\_\\ \\_\\ \\____) (_) ___/ // /__/ /", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .. " \\_/ )_) \\__/\\___\\___(______/____/(______/" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = zigzag_graphic_func(), + -- shift = {x = 0, y = 0 }, + + } + } + + + \ No newline at end of file diff --git a/stand/lua/color.lua b/stand/lua/color.lua --- a/stand/lua/color.lua +++ b/stand/lua/color.lua @@ -1,6 +1,7 @@ -- -- SPDX-License-Identifier: BSD-2-Clause-FreeBSD -- +-- Copyright (c) 2023 The SmartixOS Project -- Copyright (c) 2015 Pedro Souza -- All rights reserved. -- @@ -37,6 +38,18 @@ color.disabled = not color.isEnabled() end + + +-- The boot loader variable controlling the theme/color of the brand +loader_brand_theme = "loader_brand_theme" + +-- The boot loader variable controlling the theme/color of the menu + loader_menu_theme = "loader_menu_theme" + +-- The boot loader variable controlling the theme/color of the logo + loader_logo_theme = "loader_logo_theme" + + -- Module exports color.BLACK = 0 color.RED = 1 @@ -51,10 +64,48 @@ color.BRIGHT = 1 color.DIM = 2 +--- Magic variables/values used to decide which part of the bootloader display to colorized +-- These numbers are chosen at random. In fact they have a specific order still chosen at random. +-- For the brand the digits go from 3 to 0 in descending order +-- For the menu the digits go from 4 to 1 in descending order +-- For the logo the digits go from 5 to 2 in descending order +color.BRAND = 3210 +color.MENU = 4321 +color.LOGO = 5432 + +-- A table mapping color names to their numerical value +--color.table["red"] = color.RED = 1 +color.table = { + + -- no-color + ["no-color"]= color.DEFAULT, + + -- color.RED = 1 + ["red"]= color.RED, + + -- color.GREEN = 2 + ["green"]= color.GREEN, + + -- color.YELLOW = 3 + ["yellow"]= color.YELLOW, + + -- color.BLUE = 4 + ["blue"]= color.BLUE, + + -- color.MAGENTA = 5 + ["magenta"]= color.MAGENTA, + + -- color.CYAN = 6 + ["cyan"]= color.CYAN, + +} --end colors.table + + + function color.isEnabled() - local c = loader.getenv("loader_color") - if c ~= nil then - return c:lower() ~= "no" and c ~= "0" + local loader_color = loader.getenv("loader_color") + if loader_color ~= nil then + return loader_color:lower() ~= "no" and loader_color ~= "0" end return true end @@ -116,7 +167,41 @@ return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m" end -recalcDisabled() +function recalcDisabled() hook.register("config.loaded", recalcDisabled) +end + + +-- The requested theme +local request + +-- A function to return the requested theme for a specific section (portion or part) of the bootloader display +-- The bootloader display is logically and physically divided in three sections; the brand which displays the vendor's +-- trademarked name, the menu that shows a set of options to pick from, and the logo section which displays the vendor's +-- trademarked logo. Each section can be stylized individually and this helper function is there to return the requested theme for +-- a specific section of the display. It does this by searching for certain bootloader variables which normally contain color names example: "red" +-- that are mapped to the correct numerical value using the color table (color.table) above. +function color.getTheme(display_section) + + -- reset the request variable + request = nil + + if display_section == color.BRAND then + request = loader.getenv(loader_brand_theme) + elseif display_section == color.MENU then + request = loader.getenv(loader_menu_theme) + elseif display_section == color.LOGO then + request = loader.getenv(loader_logo_theme) + + end -- end if + + -- if things go bad, return the red theme as the default + if request == nil then + return color.table["red"] + end + + return color.table[request] +end + return color diff --git a/stand/lua/core.lua b/stand/lua/core.lua --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -1,6 +1,7 @@ -- -- SPDX-License-Identifier: BSD-2-Clause-FreeBSD -- +-- Copyright (c) 2023 The SmartixOS Project -- Copyright (c) 2015 Pedro Souza -- Copyright (c) 2018 Kyle Evans -- All rights reserved. @@ -32,14 +33,37 @@ local config = require("config") local hook = require("hook") -local core = {} +-- sm (safe mode). A variable indicating whether safe mode is on or not. It is set below +-- su (single user mode). A variable indicating whether single user mode is on or not. It is set below +local core = {sm, su, acpi,} local default_safe_mode = false local default_single_user = false local default_verbose = false - local bootenv_list = "bootenvs" +-- The list of directories expected to contain bootloader scripts. +loader_search_path = { "/boot/lua/", "/boot/lua/logo/", "/boot/lua/brand/",} + +-- Module exports +-- Commonly appearing constants +core.KEY_BACKSPACE = 8 +core.KEY_ENTER = 13 +core.KEY_DELETE = 127 + +-- Note that this is a decimal representation, despite the leading 0 that in +-- other contexts (outside of Lua) may mean 'octal' +core.KEYSTR_ESCAPE = "\027" +core.KEYSTR_CSI = core.KEYSTR_ESCAPE .. "[" +core.KEYSTR_RESET = core.KEYSTR_ESCAPE .. "c" + +core.MENU_RETURN = "return" +core.MENU_ENTRY = "entry" +core.MENU_SEPARATOR = "separator" +core.MENU_SUBMENU = "submenu" +core.MENU_CAROUSEL_ENTRY = "carousel_entry" + + local function composeLoaderCmd(cmd_name, argstr) if argstr ~= nil then cmd_name = cmd_name .. " " .. argstr @@ -95,23 +119,83 @@ return dofile(module) end --- Module exports --- Commonly appearing constants -core.KEY_BACKSPACE = 8 -core.KEY_ENTER = 13 -core.KEY_DELETE = 127 --- Note that this is a decimal representation, despite the leading 0 that in --- other contexts (outside of Lua) may mean 'octal' -core.KEYSTR_ESCAPE = "\027" -core.KEYSTR_CSI = core.KEYSTR_ESCAPE .. "[" -core.KEYSTR_RESET = core.KEYSTR_ESCAPE .. "c" +-- A helper function used to check the attributes of the given file name. +-- This function is used in the boot procedure and its role is to take a file and go through +-- a fixed list of search directories in search for its existence. These directories normally contain bootloader scripts +-- that partake in the display of the bootloader menu. -core.MENU_RETURN = "return" -core.MENU_ENTRY = "entry" -core.MENU_SEPARATOR = "separator" -core.MENU_SUBMENU = "submenu" -core.MENU_CAROUSEL_ENTRY = "carousel_entry" +-- Return values +-- This function returns two values +-- In the ideal case the function returns the full path of the given filename if the file exists +-- and a success message normally just 'success' as the second return value. +-- In the worse case scenario the function will always return nil as the first return value +-- and a specific error message giving more details about the failure as the second return value. + +function check_file_attr (filename) + + local fullpath + local array_size = #loader_search_path + + for i = 1, array_size do + + fullpath = loader_search_path[i] .. filename .. ".lua" + + -- get the file type of the given filename + local attr, errorMsg = lfs.attributes (fullpath,"mode") + + -- the file in question has been found + if(attr == "file") then + return fullpath, "success" + + -- we did not find the file but we are not done going through the list of search path directories + elseif (not attr and i < array_size) then + + goto continue + + -- we did not find the file and we are done going through the list of search path directories + elseif (not attr and i == array_size) then + + return nil, errorMsg + + -- the inode in question is not a file but we are not done going through the list of search path directories + elseif (attr ~= "file" and i < array_size) then + + goto continue + + -- the inode in question is not a file and we are done going through the list of search path directories + elseif (attr ~= "file" and i == array_size) then + + return nil, errorMsg + + -- catch all clause + else + return nil, errorMsg + end -- if + + + ::continue:: + + end -- for + +end -- check_file_attr + + +-- This helper function is used to read lua script files used during the boot process +function include_file(file_name) + + local file, message = check_file_attr(file_name) + + if(file ~= nil) then + return dofile(file) + + else + return + + end + + +end -- include_file function core.setVerbose(verbose) if verbose == nil then @@ -140,25 +224,25 @@ end function core.getACPIPresent(checking_system_defaults) - local c = loader.getenv("hint.acpi.0.rsdp") + local acpi_value = loader.getenv("hint.acpi.0.rsdp") - if c ~= nil then + if acpi_value ~= nil then if checking_system_defaults then return true end -- Otherwise, respect disabled if it's set - c = loader.getenv("hint.acpi.0.disabled") - return c == nil or tonumber(c) ~= 1 + acpi_value = loader.getenv("hint.acpi.0.disabled") + return acpi_value == nil or tonumber(acpi_value) ~= 1 end return false end -function core.setACPI(acpi) - if acpi == nil then - acpi = not core.acpi +function core.setACPI(arg_acpi) + if arg_acpi == nil then + arg_acpi = not core.acpi end - if acpi then + if arg_acpi then loader.setenv("acpi_load", "YES") loader.setenv("hint.acpi.0.disabled", "0") loader.unsetenv("loader.acpi_disabled_by_user") @@ -167,11 +251,12 @@ loader.setenv("hint.acpi.0.disabled", "1") loader.setenv("loader.acpi_disabled_by_user", "1") end - core.acpi = acpi + core.acpi = arg_acpi end function core.setSafeMode(safe_mode) if safe_mode == nil then + -- if the argument is null use the default safe_mode = not core.sm end if safe_mode then @@ -206,24 +291,24 @@ return core.cached_kernels end - local k = loader.getenv("kernel") - local v = loader.getenv("kernels") + local kernel = loader.getenv("kernel") + local kernels_list = loader.getenv("kernels") local autodetect = loader.getenv("kernels_autodetect") or "" - local kernels = {} + local kernels_table = {} local unique = {} local i = 0 - if k ~= nil then + if kernel ~= nil then i = i + 1 - kernels[i] = k - unique[k] = true + kernels_table[i] = kernel + unique[kernel] = true end - if v ~= nil then - for n in v:gmatch("([^;, ]+)[;, ]?") do + if kernels_list ~= nil then + for n in kernels_list:gmatch("([^;, ]+)[;, ]?") do if unique[n] == nil then i = i + 1 - kernels[i] = n + kernels_table[i] = n unique[n] = true end end @@ -240,7 +325,7 @@ -- setting, kernels_autodetect. If it's set to 'yes', we'll add -- any kernels we detect based on the criteria described. if autodetect:lower() ~= "yes" then - core.cached_kernels = kernels + core.cached_kernels = kernels_table return core.cached_kernels end @@ -268,13 +353,13 @@ if unique[file] == nil then i = i + 1 - kernels[i] = file + kernels_table[i] = file unique[file] = true end ::continue:: end - core.cached_kernels = kernels + core.cached_kernels = kernels_table return core.cached_kernels end @@ -396,18 +481,19 @@ end function core.isZFSBoot() - local c = loader.getenv("currdev") + local current_dev = loader.getenv("currdev") - if c ~= nil then - return c:match("^zfs:") ~= nil + if current_dev ~= nil then + return current_dev:match("^zfs:") ~= nil end return false end + function core.isFramebufferConsole() - local c = loader.getenv("console") - if c ~= nil then - if c:find("efi") == nil and c:find("vidconsole") == nil then + local cnsole = loader.getenv("console") + if cnsole ~= nil then + if cnsole:find("efi") == nil and cnsole:find("vidconsole") == nil then return false end if loader.getenv("screen.depth") ~= nil then @@ -418,12 +504,12 @@ end function core.isSerialConsole() - local c = loader.getenv("console") - if c ~= nil then + local cnsole = loader.getenv("console") + if cnsole ~= nil then -- serial console is comconsole, but also userboot. -- userboot is there, because we have no way to know -- if the user terminal can draw unicode box chars or not. - if c:find("comconsole") ~= nil or c:find("userboot") ~= nil then + if cnsole:find("comconsole") ~= nil or cnsole:find("userboot") ~= nil then return true end end @@ -431,13 +517,13 @@ end function core.isSerialBoot() - local s = loader.getenv("boot_serial") - if s ~= nil then + local serialB = loader.getenv("boot_serial") + if serialB ~= nil then return true end - local m = loader.getenv("boot_multicons") - if m ~= nil then + local multiB = loader.getenv("boot_multicons") + if multiB ~= nil then return true end return false diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -1,8 +1,10 @@ -- -- SPDX-License-Identifier: BSD-2-Clause-FreeBSD -- +-- Copyright (c) 2023 The SmartixOS Project -- Copyright (c) 2015 Pedro Souza -- Copyright (c) 2018 Kyle Evans + -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -29,14 +31,81 @@ -- $FreeBSD$ -- + local color = require("color") local config = require("config") local core = require("core") local screen = require("screen") +local fbsd_graphic_func = function () + return{ + " ______ ____ _____ _____ ", + " | ____| | _ \\ / ____| __ \\ ", + " | |___ _ __ ___ ___ | |_) | (___ | | | |", + " | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |", + " | | | | | __/ __/| |_) |____) | |__| |", + " | | | | | | || | | |", + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .." |_| |_| \\___|\\___||____/|_____/|_____/ " .. color.resetfg() ) + } +end + + +local orb_graphic_func = function() + return { + " \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", + } + end + +local fbsd_brand = { + brand = { + graphic = fbsd_graphic_func(), + image = "/boot/images/freebsd-brand-rev.png", +-- shift = {x = 0, y = 0 }, + } -- end brand + } -- end fbsd_brand + + -- this table is not necessarily empty but just holds empty logo and brand definitions to be reused + -- whenever an empty logo or brand is needed +local empty_table = { + brand = { + graphic = "", + image = nil, +-- shift = {x = 0, y = 0}, + }, + + logo = { + graphic = "", + image = nil, + shift = {x = 17, y = 0}, + } + + } -- end empty_table + local orb_logo = { + logo = { + graphic = orb_graphic_func(), + requires_color = true, + shift = {x = 2, y = 3}, + image = "/boot/images/freebsd-logo-rev.png", + image_rl = 15 + + } -- end logo +} -- end orb_logo local drawer = {} -local fbsd_brand local none local menu_name_handlers @@ -49,96 +118,213 @@ local default_shift local shift + +local welcome_msg = "Welcome to FreeBSD" + +-- A helper function to retrieve the content of the given object +local function getContent(object) + if type(object) == "function" then + + return object() + + end + + -- further test can be implemented + -- elseif type() then end + return object + +end + local function menuEntryName(drawing_menu, entry) local name_handler = menu_name_handlers[entry.entry_type] if name_handler ~= nil then return name_handler(drawing_menu, entry) end - if type(entry.name) == "function" then - return entry.name() - end - return entry.name + return getContent(entry.name) end + local function processFile(gfxname) if gfxname == nil then return false, "Missing filename" end - local ret = try_include('gfx-' .. gfxname) - if ret == nil then + local returned_table = include_file('gfx-' .. gfxname) + if returned_table == nil then return false, "Failed to include gfx-" .. gfxname end -- Legacy format - if type(ret) ~= "table" then + if type(returned_table) ~= "table" then return true end - for gfxtype, def in pairs(ret) do - if gfxtype == "brand" then - drawer.addBrand(gfxname, def) - elseif gfxtype == "logo" then - drawer.addLogo(gfxname, def) + for key, value in pairs(returned_table) do + if key == "brand" then + drawer.addBrand(gfxname, value) + elseif key == "logo" then + drawer.addLogo(gfxname, value) else - return false, "Unknown graphics type '" .. gfxtype .. - "'" + return false, "Unknown graphics type '" .. key .. "'" end end return true end -local function getBranddef(brand) - if brand == nil then +-- This function takes a file which is supposed to contained a table representing a logo or brand, +-- and caches its content in another global table used as cache. +local function cache_table(givenTable,filename) +-- Legacy format + if type(givenTable) ~= "table" then + return true + end + + for key, value in pairs(givenTable) do + if key == "brand" then + drawer.addBrand(filename, value) + elseif key == "logo" then + drawer.addLogo(filename, value) + else + return false, "Unknown graphics type '" .. key .. "'" + end + end + +end + + + +local function fetchFile(prefix , filename) + if filename == nil then + return false, "Missing filename" + end + + if prefix == nil or prefix == "" then + prefix = 'gfx-' + end + + + local returned_table = include_file(prefix .. filename) + if returned_table == nil then + return false, "Failed to include " .. prefix .. filename + end + + local result = cache_table(returned_table, filename) + + if not result then + return result + end + + return true +end + + +local function getBranddef(brand_name) + if brand_name == nil then return nil end -- Look it up - local branddef = branddefs[brand] + local branddef = branddefs[brand_name] -- Try to pull it in if branddef == nil then - local res, err = processFile(brand) + local res, err = processFile(brand_name) if not res then -- This fallback should go away after FreeBSD 13. - try_include('brand-' .. brand) + + -- try_include('brand-' .. brand_name) + include_file('brand-' .. brand_name) -- If the fallback also failed, print whatever error -- we encountered in the original processing. - if branddefs[brand] == nil then + if branddefs[brand_name] == nil then + print(err) + return nil + end + end + + branddef = branddefs[brand_name] + end + + return branddef +end + + local function fetchBranddef(brand_name) + if brand_name == nil then + return nil + end + -- Look it up + local branddef = branddefs[brand_name] + + -- Try to pull it in + if branddef == nil then + local res, err = fetchFile('gfx-',brand_name) + if not res then + + res, err = fetchFile('brand-',brand_name) + + if branddefs[brand_name] == nil then print(err) return nil end end - branddef = branddefs[brand] + branddef = branddefs[brand_name] end return branddef end -local function getLogodef(logo) - if logo == nil then +local function fetchLogodef(logo_name) + if logo_name == nil then + return nil + end + -- Look it up + local logodef = logodefs[logo_name] + + -- Try to pull it in + if logodef == nil then + local res, err = fetchFile('gfx-',logo_name) + if not res then + + res, err = fetchFile('logo-',logo_name) + + if logodefs[logo_name] == nil then + print(err) + return nil + end + end + + logodef = logodefs[logo_name] + end + + return logodef +end + +local function getLogodef(logo_name) + if logo_name == nil then return nil end -- Look it up - local logodef = logodefs[logo] + local logodef = logodefs[logo_name] -- Try to pull it in if logodef == nil then - local res, err = processFile(logo) + local res, err = processFile(logo_name) if not res then -- This fallback should go away after FreeBSD 13. - try_include('logo-' .. logo) + + -- try_include('logo-' .. logo_name) + include_file('logo-' .. logo_name) -- If the fallback also failed, print whatever error -- we encountered in the original processing. - if logodefs[logo] == nil then + if logodefs[logo_name] == nil then print(err) return nil end end - logodef = logodefs[logo] + logodef = logodefs[logo_name] end return logodef @@ -152,20 +338,17 @@ end local function drawmenu(menudef) - local x = menu_position.x - local y = menu_position.y + local XPosition = menu_position.x + local YPosition = menu_position.y - x = x + shift.x - y = y + shift.y + XPosition = XPosition + shift.x + YPosition = YPosition + shift.y -- print the menu and build the alias table local alias_table = {} local entry_num = 0 - local menu_entries = menudef.entries + local menu_entries = getContent(menudef.entries) local effective_line_num = 0 - if type(menu_entries) == "function" then - menu_entries = menu_entries() - end for _, e in ipairs(menu_entries) do -- Allow menu items to be conditionally visible by specifying -- a visible function. @@ -175,7 +358,7 @@ effective_line_num = effective_line_num + 1 if e.entry_type ~= core.MENU_SEPARATOR then entry_num = entry_num + 1 - screen.setcursor(x, y + effective_line_num) + screen.setcursor(XPosition, YPosition + effective_line_num) printc(entry_num .. ". " .. menuEntryName(menudef, e)) @@ -187,7 +370,7 @@ end end else - screen.setcursor(x, y + effective_line_num) + screen.setcursor(XPosition, YPosition + effective_line_num) printc(menuEntryName(menudef, e)) end ::continue:: @@ -203,10 +386,10 @@ end local function drawframe() - local x = menu_position.x - 3 - local y = menu_position.y - 1 - local w = frame_size.w - local h = frame_size.h + local XPosition = menu_position.x - 3 + local YPosition = menu_position.y - 1 + local width = frame_size.w + local height = frame_size.h local framestyle = loader.getenv("loader_menu_frame") or defaultframe() local framespec = drawer.frame_styles[framestyle] @@ -216,59 +399,59 @@ return false end - local hl = framespec.horizontal - local vl = framespec.vertical + local horizontal = framespec.horizontal + local vertical = framespec.vertical - local tl = framespec.top_left - local bl = framespec.bottom_left - local tr = framespec.top_right - local br = framespec.bottom_right + local top_left = framespec.top_left + local bottom_left = framespec.bottom_left + local top_right = framespec.top_right + local bottom_right = framespec.bottom_right - x = x + shift.x - y = y + shift.y + XPosition = XPosition + shift.x + YPosition = YPosition + shift.y if core.isFramebufferConsole() and loader.term_drawrect ~= nil then - loader.term_drawrect(x, y, x + w, y + h) + loader.term_drawrect(XPosition, YPosition, XPosition + width, YPosition + height) return true end - screen.setcursor(x, y); printc(tl) - screen.setcursor(x, y + h); printc(bl) - screen.setcursor(x + w, y); printc(tr) - screen.setcursor(x + w, y + h); printc(br) + screen.setcursor(XPosition, YPosition); printc(top_left) + screen.setcursor(XPosition, YPosition + height); printc(bottom_left) + screen.setcursor(XPosition + width, YPosition); printc(top_right) + screen.setcursor(XPosition + width, YPosition + height); printc(bottom_right) - screen.setcursor(x + 1, y) - for _ = 1, w - 1 do - printc(hl) + screen.setcursor(XPosition + 1, YPosition) + for _ = 1, width - 1 do + printc(horizontal) end - screen.setcursor(x + 1, y + h) - for _ = 1, w - 1 do - printc(hl) + screen.setcursor(XPosition + 1, YPosition + height) + for _ = 1, width - 1 do + printc(horizontal) end - for i = 1, h - 1 do - screen.setcursor(x, y + i) - printc(vl) - screen.setcursor(x + w, y + i) - printc(vl) + for i = 1, height - 1 do + screen.setcursor(XPosition, YPosition + i) + printc(vertical) + screen.setcursor(XPosition + width, YPosition + i) + printc(vertical) end return true end local function drawbox() - local x = menu_position.x - 3 - local y = menu_position.y - 1 - local w = frame_size.w - local menu_header = loader.getenv("loader_menu_title") or - "Welcome to FreeBSD" + local Xposition = menu_position.x - 3 + local Yposition = menu_position.y - 1 + local width = frame_size.w + local menu_header = loader.getenv("loader_menu_title") or welcome_msg + local menu_header_align = loader.getenv("loader_menu_title_align") local menu_header_x - x = x + shift.x - y = y + shift.y + Xposition = Xposition + shift.x + Yposition = Yposition + shift.y - if drawframe(x, y, w) == false then + if drawframe(Xposition, Yposition, width) == false then return end @@ -276,16 +459,16 @@ menu_header_align = menu_header_align:lower() if menu_header_align == "left" then -- Just inside the left border on top - menu_header_x = x + 1 + menu_header_x = Xposition + 1 elseif menu_header_align == "right" then -- Just inside the right border on top - menu_header_x = x + w - #menu_header + menu_header_x = Xposition + width - #menu_header end end if menu_header_x == nil then - menu_header_x = x + (w // 2) - (#menu_header // 2) + menu_header_x = Xposition + (width // 2) - (#menu_header // 2) end - screen.setcursor(menu_header_x - 1, y) + screen.setcursor(menu_header_x - 1, Yposition) if menu_header ~= "" then printc(" " .. menu_header .. " ") end @@ -293,24 +476,29 @@ end local function drawbrand() - local x = tonumber(loader.getenv("loader_brand_x")) or + local XPosition = tonumber(loader.getenv("loader_brand_x")) or brand_position.x - local y = tonumber(loader.getenv("loader_brand_y")) or + local YPosition = tonumber(loader.getenv("loader_brand_y")) or brand_position.y - local branddef = getBranddef(loader.getenv("loader_brand")) + local requested_brand= loader.getenv("loader_brand"); + local branddef = fetchBranddef(requested_brand) + -- local branddef = getBranddef(loader.getenv("loader_brand")) if branddef == nil then - branddef = getBranddef(drawer.default_brand) + branddef = fetchBranddef(drawer.default_brand) + -- branddef = getBranddef(drawer.default_brand) end - local graphic = branddef.graphic + +-- local graphic = branddef.graphic + local graphic = getContent(branddef.graphic) - x = x + shift.x - y = y + shift.y + XPosition = XPosition + shift.x + YPosition = YPosition + shift.y if branddef.shift ~= nil then - x = x + branddef.shift.x - y = y + branddef.shift.y + XPosition = XPosition + branddef.shift.x + YPosition = YPosition + branddef.shift.y end if core.isFramebufferConsole() and @@ -321,21 +509,28 @@ return true end end - draw(x, y, graphic) + draw(XPosition, YPosition, graphic) end local function drawlogo() - local x = tonumber(loader.getenv("loader_logo_x")) or + local XPosition = tonumber(loader.getenv("loader_logo_x")) or logo_position.x - local y = tonumber(loader.getenv("loader_logo_y")) or + local YPosition = tonumber(loader.getenv("loader_logo_y")) or logo_position.y - local logo = loader.getenv("loader_logo") + local logo = loader.getenv("loader_logo") local colored = color.isEnabled() - local logodef = getLogodef(logo) + -- local logodef = getLogodef(logo) + local logodef = fetchLogodef(logo) + if logodef == nil then + logodef = fetchLogodef(drawer.default_logo) + -- logodef = getLogodef(drawer.default_logo) + end + + local graphic = getContent(logodef.graphic) - if logodef == nil or logodef.graphic == nil or + if logodef == nil or graphic == nil or (not colored and logodef.requires_color) then -- Choose a sensible default if colored then @@ -350,18 +545,18 @@ end end - if logodef ~= nil and logodef.graphic == none then + if logodef ~= nil and graphic == none then shift = logodef.shift else shift = default_shift end - x = x + shift.x - y = y + shift.y + XPosition = XPosition + shift.x + YPosition = YPosition + shift.y if logodef ~= nil and logodef.shift ~= nil then - x = x + logodef.shift.x - y = y + logodef.shift.y + XPosition = XPosition + logodef.shift.x + YPosition = YPosition + logodef.shift.y end if core.isFramebufferConsole() and @@ -372,33 +567,27 @@ if logodef.image_rl ~= nil then y1 = logodef.image_rl end - if loader.term_putimage(logodef.image, x, y, 0, y + y1, 0) + if loader.term_putimage(logodef.image, XPosition, YPosition, 0, YPosition + y1, 0) then return true end end - draw(x, y, logodef.graphic) -end + draw(XPosition, YPosition, graphic) +end -- drawlogo() local function drawitem(func) local console = loader.getenv("console") + local c for c in string.gmatch(console, "%w+") do loader.setenv("console", c) func() end loader.setenv("console", console) -end +end -- drawitem(func) + + -fbsd_brand = { -" ______ ____ _____ _____ ", -" | ____| | _ \\ / ____| __ \\ ", -" | |___ _ __ ___ ___ | |_) | (___ | | | |", -" | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |", -" | | | | | __/ __/| |_) |____) | |__| |", -" | | | | | | || | | |", -" |_| |_| \\___|\\___||____/|_____/|_____/ " -} none = {""} menu_name_handlers = { @@ -409,10 +598,11 @@ -- types not specified here is to use entry.name directly. [core.MENU_SEPARATOR] = function(_, entry) if entry.name ~= nil then - if type(entry.name) == "function" then - return entry.name() - end - return entry.name +-- if type(entry.name) == "function" then +-- return entry.name() +-- end +-- return entry.name + return getContent(entry.name) end return "" end, @@ -420,6 +610,7 @@ local carid = entry.carousel_id local caridx = config.getCarouselIndex(carid) local choices = entry.items + if type(choices) == "function" then choices = choices() end @@ -433,32 +624,74 @@ branddefs = { -- Indexed by valid values for loader_brand in loader.conf(5). Valid -- keys are: graphic (table depicting graphic) - ["fbsd"] = { - graphic = fbsd_brand, - image = "/boot/images/freebsd-brand-rev.png", - }, - ["none"] = { - graphic = none, - }, + ["fbsd"] = fbsd_brand.brand, + + ["none"] = empty_table.brand, } +local tribute_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .::' .." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .::: ..... '::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::::. :::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::'::''::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .:..:' :::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ::::::: :::::::::'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " . :::::::'.::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ..::.::::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "..'::.: ':::::::::::::'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "':::::::::.'::::::::'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::.::::::::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ':::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::.." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .......:::::::::::::::...." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :'....'''''::::::::. '''''::::.." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '''':::::::::::.'' .: .:::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ..::::::::'" .. color.resetfg() ), + } +end + + +local tribute_logo = { + logo = { + graphic = tribute_graphic_func(), + -- requires_color = true, + shift = {x = 0, y = 1 }, + -- image = "/boot/images/freebsd-logo-rev.png", + -- image_rl = 15 + + } -- end logo +} -- end tribute_logo + logodefs = { -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys -- are: requires_color (boolean), graphic (table depicting graphic), and -- shift (table containing x and y). - ["tribute"] = { - graphic = fbsd_brand, - }, + ["tribute"] = tribute_logo.logo, + +-- ["tributebw"] = { +-- graphic = fbsd_graphic_func(), +-- shift = {x = 0, y = 4}, +-- }, + ["tributebw"] = { - graphic = fbsd_brand, - }, - ["none"] = { - graphic = none, - shift = {x = 17, y = 0}, - }, + graphic = empty_table.logo.graphic, + img = empty_table.logo.img, + shift = empty_table.logo.shift, + +}, + + ["orb"] = orb_logo.logo, + + ["none"] = empty_table.logo, + } -brand_position = {x = 2, y = 1} +brand_position = {x = 1, y = 1} + logo_position = {x = 46, y = 4} menu_position = {x = 5, y = 10} frame_size = {w = 42, h = 13} @@ -466,8 +699,10 @@ shift = default_shift -- Module exports +drawer.default_logo = 'orb' drawer.default_brand = 'fbsd' drawer.default_color_logodef = 'orb' + drawer.default_bw_logodef = 'orbbw' -- For when things go terribly wrong; this def should be present here in the -- drawer module in case it's a filesystem issue. diff --git a/stand/lua/gfx-fork.lua b/stand/lua/gfx-fork.lua new file mode 100644 --- /dev/null +++ b/stand/lua/gfx-fork.lua @@ -0,0 +1,171 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " .::' .." , + " .::: ..... '::." , + " :::::::::::::. :::." , + " :::'::''::::::::::::" , + " .:..:' :::::::::::" , + " ::::::: :::::::::'" , + " . :::::::'.::::::::" , + " ..::.::::::::::::::::" , + "..'::.: ':::::::::::::'" , + "':::::::::.'::::::::'" , + " :::::.::::::::." , + " '::::::::::::::" , + " ':::::::::::" , + " :::::::::::" , + " :::::::::::." , + " :::::::::::.." , + " .......:::::::::::::::...." , + " :'....'''''::::::::. '''''::::.." , + " '''':::::::::::.'' .: .:::" , + " ..::::::::'" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local water_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " _,,' _" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,' | _____ |-." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " / ' `'. | \\" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " \\ ,-',--. `' |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " |`,_<_ \\ /" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " / | | _,'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " . ' .'_' |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,_/Y.\\ '' /" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "__ v /| `-. _," .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " -,=>-.-''''\\ |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " / -.' \\" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " -__ |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " \\ |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " | |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " `. `." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " \\__ ._" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ____,..^-- /|[-._`-..__" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " |=...,-'''`\\ :,/. ''`--.=:-._" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '---`[:===:=:::.-' _ ) |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " _.-' '' /" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = water_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } + + + + + + + + + + + + + + + + + + + + + diff --git a/stand/lua/gfx-forward.lua b/stand/lua/gfx-forward.lua new file mode 100644 --- /dev/null +++ b/stand/lua/gfx-forward.lua @@ -0,0 +1,125 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " ______ ____ _____ ____", + " / ____/_____ ___ ___ / __ )/ ___/ / __ \\", + " / /_ / ___// _ \\ / _ \\ / __ |\\__ \\ / / / /", + " / __/ / / / __// __// /_/ /___/ // /_/ /", + " /_/ /_/ \\___/ \\___//_____//____//_____/" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local fwd_graphic_func = function() + return { + " ______ ____ _____ ____", + " / ____/_____ ___ ___ / __ )/ ___/ / __ \\", + " / /_ / ___// _ \\ / _ \\ / __ |\\__ \\ / / / /", + " / __/ / / / __// __// /_/ /___/ // /_/ /", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .. " /_/ /_/ \\___/ \\___//_____//____//_____/" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = fwd_graphic_func(), + -- shift = {x = 0, y = 0 }, + + } + } + + + + + diff --git a/stand/lua/gfx-space.lua b/stand/lua/gfx-space.lua new file mode 100644 --- /dev/null +++ b/stand/lua/gfx-space.lua @@ -0,0 +1,193 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + "*********WMTuE*******WWWW********" , + "*******WMt:jWWMMMWWW*WW;J%*******" , + "*******W::::::::::;F%WWb::%W*****" , + "*******k:;gW;gg:,:::::::::jW*****" , + "*******WjMMjWWWW:::::::::jWW*****" , + "*****WWK= %WW:::::::gWW*******" , + "**WN*Wv::,: .WWv::::::%W*********" , + "*MNkB%,:,::::::::::::;WW*********" , + "WWw%M%Wgj:::::::::::gW***********" , + "p%MW$EO:l%Wj::::::lWWW***********" , + "*****K:::Y*5:::::::%*************" , + "*****Wg::::::::::::lWW***********" , + "*****WWWWc:::::::::;WW***********" , + "********WK:::::;;::JW************" , + "*********k::::::!Gz:%W***********" , + "*********WD::::::::::%WW*********" , + "**WWMMMMMMQ8VjEk,gyQg;:!F*MMWW***" , + "*%$MMMNgWWWgj::::::j%**WWgggg;!FM" , + "*WWWWW$W$$WWWgwWMN$gW****WWWFWWW:" , + "**************W*******WMMV::::::j" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local space_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*********WMTuE*******WWWW********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*******WMt:jWWMMMWWW*WW;J%*******" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*******W::::::::::;F%WWb::%W*****" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*******k:;gW;gg:,:::::::::jW*****" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*******WjMMjWWWW:::::::::jWW*****" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*****WWK= %WW:::::::gWW*******" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "**WN*Wv::,: .WWv::::::%W*********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*MNkB%,:,::::::::::::;WW*********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "WWw%M%Wgj:::::::::::gW***********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "p%MW$EO:l%Wj::::::lWWW***********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*****K:::Y*5:::::::%*************" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*****Wg::::::::::::lWW***********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*****WWWWc:::::::::;WW***********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "********WK:::::;;::JW************" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*********k::::::!Gz:%W***********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*********WD::::::::::%WW*********" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "**WWMMMMMMQ8VjEk,gyQg;:!F*MMWW***" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*%$MMMNgWWWgj::::::j%**WWgggg;!FM" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "*WWWWW$W$$WWWgwWMN$gW****WWWFWWW:" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "**************W*******WMMV::::::j" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = space_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stand/lua/gfx-speedy.lua b/stand/lua/gfx-speedy.lua new file mode 100644 --- /dev/null +++ b/stand/lua/gfx-speedy.lua @@ -0,0 +1,121 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + + +-- The local function responsible for drawing the brand using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " ______ ____ _____ ____", + " / ____/_____ ___ ___ / __ )/ ___/ / __ \\", + " / /_ / ___// _ \\ / _ \\ / __ |\\__ \\ / / / /", + " / __/ / / / __// __// /_/ /___/ // /_/ /", + " /_/ /_/ \\___/ \\___//_____//____//_____/" , + +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local speedy_graphic_func = function() + return { + " __________ _______________________", + " ___ ____/___________________ __ )_ ___/__ __ \\", + " __ /_ __ ___/ _ \\ _ \\_ __ |____ \\__ / / /", + " _ __/ _ / / __/ __/ /_/ /____/ /_ /_/ /", +color.highlight(color.escapefg(color.getTheme(color.BRAND)) .." /_/ /_/ \\___/\\___//_____/ /____/ /_____/" .. color.resetfg() ), + } +end + + +return { + brand = { + graphic = speedy_graphic_func(), + -- shift = {x = 0, y = 0 }, + + } + } diff --git a/stand/lua/logo/Makefile b/stand/lua/logo/Makefile new file mode 100644 --- /dev/null +++ b/stand/lua/logo/Makefile @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include + + +FILESDIR= /boot/lua/logo + +FILES+= logo-air.lua logo-bycle.lua logo-faso.lua logo-hbday.lua logo-kati.lua logo-mountain.lua logo-river.lua logo-rocky.lua logo-volcano.lua + + + + + +.include diff --git a/stand/lua/logo/logo-air.lua b/stand/lua/logo/logo-air.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-air.lua @@ -0,0 +1,150 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " .::' .." , + " .::: ..... '::." , + " :::::::::::::. :::." , + " :::'::''::::::::::::" , + " .:..:' :::::::::::" , + " ::::::: :::::::::'" , + " . :::::::'.::::::::" , + " ..::.::::::::::::::::" , + "..'::.: ':::::::::::::'" , + "':::::::::.'::::::::'" , + " :::::.::::::::." , + " '::::::::::::::" , + " ':::::::::::" , + " :::::::::::" , + " :::::::::::." , + " :::::::::::.." , + " .......:::::::::::::::...." , + " :'....'''''::::::::. '''''::::.." , + " '''':::::::::::.'' .: .:::" , + " ..::::::::'" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local air_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .::' .." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .::: ..... '::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::::. :::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::'::''::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .:..:' :::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ::::::: :::::::::'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " . :::::::'.::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ..::.::::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "..'::.: ':::::::::::::'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "':::::::::.'::::::::'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::.::::::::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ':::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::.." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .......:::::::::::::::...." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :'....'''''::::::::. '''''::::.." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '''':::::::::::.'' .: .:::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ..::::::::'" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = air_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } diff --git a/stand/lua/logo/logo-bycle.lua b/stand/lua/logo/logo-bycle.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-bycle.lua @@ -0,0 +1,150 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " . ':." , + " .:' ..... :::." , + " :::.::::::::::::" , + " :::::'::::::::'" , + " :.:.. :::::::" , + " ::::: ::::::: ." , + " .:::::::::::: :::" , + " ':::::::::: ::" , + " '':::::::. '':." , + " .:::::::: ':" , + " ::::.::::::::::. :" , + " ':::::::::::::::: ::" , + " ..:::::::::::::::'" , + " ..:::::::::::::::...." , + " .:' :.'':'::::::::' ':" , + " .' ::' ':::::::::'. :" , + " : :: :'::::::'..:: :" , + " '. .:: .:::' ' :" , + " '.. .' ' '. .:'" , + " '''''' '':'''" , +]]-- + + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local bycle_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " . 'Ns." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " g@` ,____ ]@@." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " g@@m@@@@@@@W@@@[" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " M@PYA~V@@@@@@@f" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " A,]_. Y@@@@@|" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " WW@@W d@@@@@[ ." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " i@@@@WW@@@@@A 4@[" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " 'V@@@@@@@@@@ ]b" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '~M@@@@@W. '~*s" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " g@@@@@@@@ !b" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " WW@mmW@@@@@@@@@_ A" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '*AMM@@@@@@@@@@@b d!" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " itK@@@@@@@@@@@mY~" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,_.dbWM@@@@@@@@@@@_.__" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,/` i \\KVAM@@@@m/ ~e." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " i` ,,` 'iW@@@@@@s`, \\" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ] Vv ]~*M@@AA+-,@- [" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " !. [[ ,!8@! ]`" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " 'c. ./ ' \\. ,/`" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '~ '~ '~===/~" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = bycle_graphic_func(), + shift = {x = 0, y = 1 }, + + } -- end logo + } + diff --git a/stand/lua/logo/logo-faso.lua b/stand/lua/logo/logo-faso.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-faso.lua @@ -0,0 +1,153 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " . ':." , + " .:' ..... :::." , + " :::.::::::::::::" , + " :::::'::::::::'" , + " :.:.. :::::::" , + " ::::: ::::::: ." , + " .:::::::::::: :::" , + " ':::::::::: ::" , + " '':::::::. '':." , + " .:::::::: ':" , + " ::::.::::::::::. :" , + " ':::::::::::::::: ::" , + " ..:::::::::::::::'" , + " ..:::::::::::::::...." , + " .:' :.'':'::::::::' ':" , + " .' ::' ':::::::::'. :" , + " : :: :'::::::'..:: :" , + " '. .:: .:::' ' :" , + " '.. .' ' '. .:'" , + " '''''' '':'''" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local faso_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " . ':." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .:' ..... :::." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::.::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::'::::::::'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :.:.. :::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ::::: ::::::: ." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .:::::::::::: :::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ':::::::::: ::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '':::::::. '':." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .:::::::: ':" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ::::.::::::::::. :" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ':::::::::::::::: ::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ..:::::::::::::::'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ..:::::::::::::::...." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .:' :.'':'::::::::' ':" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .' ::' ':::::::::'. :" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " : :: :'::::::'..:: :" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '. .:: .:::' ' :" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '.. .' ' '. .:'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '''''' '':'''" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = faso_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } + + + diff --git a/stand/lua/logo/logo-hbday.lua b/stand/lua/logo/logo-hbday.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-hbday.lua @@ -0,0 +1,139 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +-- end of library functions + + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " (" , + " A" , + " ( | | (" , + " () | | ()" , + " || | | ||" , + " ||.| |.||" , + " / || | | ||\\" , + " | ~~ ~ ~~ |" , + " |`-.______.-'|" , + " /| |\\" , + " | | 100 Years! | |" , + " \\ `-.______.-' /" , + " `-.________.-'" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local hbd_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " (" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " A" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ( | | (" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " () | | ()" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " || | | ||" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ||.| |.||" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " / || | | ||\\" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " | ~~ ~ ~~ |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " |`-.______.-'|" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " /| |\\" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " | | 30 Years! | |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " \\ `-.______.-' /" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " `-.________.-'" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = hbd_graphic_func(), + shift = {x = 0, y = 1 }, + + } -- end logo + } + + + diff --git a/stand/lua/logo/logo-kati.lua b/stand/lua/logo/logo-kati.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-kati.lua @@ -0,0 +1,193 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " . ':." , + " .:' ..... :::." , + " :::.::::::::::::" , + " :::::'::::::::'" , + " :.:.. :::::::" , + " ::::: ::::::: ." , + " .:::::::::::: :::" , + " ':::::::::: ::" , + " '':::::::. '':." , + " .:::::::: ':" , + " ::::.::::::::::. :" , + " ':::::::::::::::: ::" , + " ..:::::::::::::::'" , + " ..:::::::::::::::...." , + " .:' :.'':'::::::::' ':" , + " .' ::' ':::::::::'. :" , + " : :: :'::::::'..:: :" , + " '. .:: .:::' ' :" , + " '.. .' ' '. .:'" , + " '''''' '':'''" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local kati_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " _" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,o Y88L" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,88P_ooooo._888b" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,8888888888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " Y88888P888888888'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " Y8b88.]8888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " d8888888888888 ,o" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " 8888888888888M888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " Y88888888888P`88L_" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ''888888888o`'Y88L" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " __ ,888888888b 88." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " d888888888888888b. d8P" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " Y8888888888888888.,88'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ']8888888888888888P'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " _oo88888888888888888ooo." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " d8P'd8[8Y8888888888P'''`Y8L" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " 8P 88P Y8888888888o. `8b" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ]8[ `88P ]88888888Pb88b Y8" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " 8b ` d88,d8888' '' _8P" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " YbL_ _,d8'''' 'Y8o_ _d8P" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ``PPPPP' `PY88PP'" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = kati_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stand/lua/logo/logo-mountain.lua b/stand/lua/logo/logo-mountain.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-mountain.lua @@ -0,0 +1,190 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + "*********WMTuE*******WWWW********" , + "*******WMt:jWWMMMWWW*WW;J%*******" , + "*******W::::::::::;F%WWb::%W*****" , + "*******k:;gW;gg:,:::::::::jW*****" , + "*******WjMMjWWWW:::::::::jWW*****" , + "*****WWK= %WW:::::::gWW*******" , + "**WN*Wv::,: .WWv::::::%W*********" , + "*MNkB%,:,::::::::::::;WW*********" , + "WWw%M%Wgj:::::::::::gW***********" , + "p%MW$EO:l%Wj::::::lWWW***********" , + "*****K:::Y*5:::::::%*************" , + "*****Wg::::::::::::lWW***********" , + "*****WWWWc:::::::::;WW***********" , + "********WK:::::;;::JW************" , + "*********k::::::!Gz:%W***********" , + "*********WD::::::::::%WW*********" , + "**WWMMMMMMQ8VjEk,gyQg;:!F*MMWW***" , + "*%$MMMNgWWWgj::::::j%**WWgggg;!FM" , + "*WWWWW$W$$WWWgwWMN$gW****WWWFWWW:" , + "**************W*******WMMV::::::j" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local mountain_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@@@MM5jd@@@@@@@MMMM@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@M#C`JMMMMMMMM@MN,?M@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@@.`...````.?TMMMt``HM@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@P`.+@.Jg.`````.````JM@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@#JMHJMMMb`````````JMM@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@MM5: dMF``````.JdM@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@MM@M:``.` .MM:``````MM@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "MM#XM,`.```..`.````.JMM@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "NmWMXMaJ..```````..JM@@@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "WHSQX3.?MNJ.``.``JMMM@@@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@F`..7T3``````.H@@@@@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@NJ.``.```.````?MM@@@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@MMMN+.``````.`?MM@@@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@@MF`````....JM@@@@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@@@b``````?4c`MM@@@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@@@MP`````````?TMM@@@@@@@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@MMMMMHMBwUT.XZ`jpWJ,.?TTMMMM@@@" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "NMMMMMgMMNaJ`..`..JM@@MNagJJ.?TW" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "MNNNNdMHNNNNgmWMMNNM@@@@MMMTMM@`" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "@@@@@@@@@@@@@M@@@@@@@MMB=+`````J" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = mountain_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stand/lua/logo/logo-river.lua b/stand/lua/logo/logo-river.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-river.lua @@ -0,0 +1,151 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " . ':." , + " .:' ..... :::." , + " :::.::::::::::::" , + " :::::'::::::::'" , + " :.:.. :::::::" , + " ::::: ::::::: ." , + " .:::::::::::: :::" , + " ':::::::::: ::" , + " '':::::::. '':." , + " .:::::::: ':" , + " ::::.::::::::::. :" , + " ':::::::::::::::: ::" , + " ..:::::::::::::::'" , + " ..:::::::::::::::...." , + " .:' :.'':'::::::::' ':" , + " .' ::' ':::::::::'. :" , + " : :: :'::::::'..:: :" , + " '. .:: .:::' ' :" , + " '.. .' ' '. .:'" , + " '''''' '':'''" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local river_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " _ 'oo" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " /8 _____ |88." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " J88/8888888d888|" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " \\8/\\/'`8888888'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " / |: \\88888|" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " 88888 |88888| _" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,88888d888888 =8|" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " \\8888888888 |L" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ''\\88888\\_ '`\\\\" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " /88888888 `." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " od8oo8888888888. /" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " `\\P8Y88888888888| //" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,L.88888888888p/'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " _,.d\\/\\88888888888,.b_" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ,/' / /`Y\\/88888o'' `." .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " / , / '|8888888\\'. \\" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " | \\` |Y//888P'.b8 |" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " \\ ./\\ _/88' |'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " `. ,' \\. ,'" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " `----' -----'" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = river_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } + diff --git a/stand/lua/logo/logo-rocky.lua b/stand/lua/logo/logo-rocky.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-rocky.lua @@ -0,0 +1,155 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " . ':." , + " .:' ..... :::." , + " :::.::::::::::::" , + " :::::'::::::::'" , + " :.:.. :::::::" , + " ::::: ::::::: ." , + " .:::::::::::: :::" , + " ':::::::::: ::" , + " '':::::::. '':." , + " .:::::::: ':" , + " ::::.::::::::::. :" , + " ':::::::::::::::: ::" , + " ..:::::::::::::::'" , + " ..:::::::::::::::...." , + " .:' :.'':'::::::::' ':" , + " .' ::' ':::::::::'. :" , + " : :: :'::::::'..:: :" , + " '. .:: .:::' ' :" , + " '.. .' ' '. .:'" , + " '''''' '':'''" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local rocky_graphic_func = function() + return { + + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888888888888888888888888888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888888888P8888888\\.88888888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "8888888/ |8/888\\Y8' 888888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888888/ ' /88888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888888\\ / o\\ /888888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "8888888|-' 88. \\8888888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "8888888| / //8\\8888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "8888888 /8 _88888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "8888888b.__ \\8\\'8\\888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888888888888| `888\\`88888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "88888P888// 8888||8888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "88888\\ `888 /8888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "8888888op `8'/88888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888888P' .=/888888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888/'.\\p.. _ ,/ppp/8888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "88/,888\\'d8\\\\' '`Y\\8b8.\\8888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "88 888' '888|\\ -' '\\88b|8888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "88.\\8P\\\\8888,,8P d8b..888/|8888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888.\\U8/d8/\\8\\./do\\`\\8O888',88888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "8888bo.:\\.d888888888\\/:::.d888888" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "888888888888888888888888888888888" .. color.resetfg() ), + + } +end + + +return { + logo = { + graphic = rocky_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } + + diff --git a/stand/lua/logo/logo-volcano.lua b/stand/lua/logo/logo-volcano.lua new file mode 100644 --- /dev/null +++ b/stand/lua/logo/logo-volcano.lua @@ -0,0 +1,173 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2023 The SmartixOS Project +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + + + + +-- loading library of functions. +local color = require("color") +local config = require("config") +local core = require("core") +local screen = require("screen") +local drawer = require("drawer") +-- end of library functions + + + + +-- The local function responsible for drawing the logo using regular ASCII strings combined with +-- Terminal Escape Sequences. The logo or brand is separately drawn using regular ASCII strings and this procedure is +-- (vendor/domain/industry/company/corporate/team/project) dependent. +-- Assuming this procedure has been done to obtain an array of string such as the one below + +--[[ + " .::' .." , + " .::: ..... '::." , + " :::::::::::::. :::." , + " :::'::''::::::::::::" , + " .:..:' :::::::::::" , + " ::::::: :::::::::'" , + " . :::::::'.::::::::" , + " ..::.::::::::::::::::" , + "..'::.: ':::::::::::::'" , + "':::::::::.'::::::::'" , + " :::::.::::::::." , + " '::::::::::::::" , + " ':::::::::::" , + " :::::::::::" , + " :::::::::::." , + " :::::::::::.." , + " .......:::::::::::::::...." , + " :'....'''''::::::::. '''''::::.." , + " '''':::::::::::.'' .: .:::" , + " ..::::::::'" , +]]-- + +-- The coloring/theming can be controlled using the color.getTheme() function call with one of the three magic values +-- (color.LOGO, color.BRAND, color.MENU) passed in as argument. + +-- The magic values are used under the hood to complete the Terminal Escape Sequence necessary to display colors. This Sequence is +-- made of specific control characters recognized by the Terminal. These specific control characters are defined by +-- termcap (or your specific terminal capabilities). The default are safe enough for a wide range of terminal since the Sequences +-- implemented in this library include the most basic terminal capabilities such as displaying the most basic colors like red +-- green, black, white, blue, yellow etc.. + + +-- The theming system leverages the immutability ability of the Lua scripting language. +-- The idea is to return the same array of strings drawn differently on demand. By leveraging this ability, +-- the rendition time is near instantaneous and the memory usage efficiently and automatically managed by the Lua +-- garbage collector which, based on the current reference discards un-referenced strings as fast as memory allows. +-- The end result when sitting on the terminal is near instantaneous change for testing and color manipulation before booting. +-- The garbage collection aspect is not necessary ideal because this file (the logo/brand) is executed and the result returned. +-- The small catch is that the table is later stored in global table used as cache. + + +-- Manual theming such as the array of string below can still be achieved + +--[[ +" \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", +]] +-- In fact this is how the old system works; the new system is fully compatible with the manual method. To be more specific +-- the new system is a super-set of the old or the old system is a sub-set of the new system; which ever makes more sense. +-- The new system allows automation but is limited when it comes to intricate designs; the effort level goes up quickly. In contrast, +-- the new system makes it easy to access several terminal capabilities with few predefined library functions. +-- On the other end, the old system makes it easy to draw very detailed designs since full control is given to the designer +-- as long as he/she is familiar with Terminal Escape Sequences and their characteristics; the new system can still +-- be used for detailed design, but the effort and discomfort levels go up considerably. +local volcano_graphic_func = function() + return { + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::::::'.:::::::::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. ":::::::::: .::::::::::: ':::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::: '::: ::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::: .: .. ::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::: '' :::: .::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::' ::: .::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::: :: ::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::: ::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::.. .:::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. ":::::::' ::. :::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::' ''' :::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. ":::::::. ::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. ":::::::::: ::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::::' '::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::::: ' ::::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. ":::::::::::' '::::::::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::'':'''.. ..:. ''':::::::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::.::::. .:::::.....''':" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "::::::::::::::..:::::::::::::':::" .. color.resetfg() ), + color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. ":::::::::::::::::::::::::'' .:" .. color.resetfg() ), + } +end + + +return { + logo = { + graphic = volcano_graphic_func, + shift = {x = 0, y = 1 }, + + } -- end logo + } + + + + + + + + + + + + + + + + + + + + + + diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -1,8 +1,10 @@ -- -- SPDX-License-Identifier: BSD-2-Clause-FreeBSD -- +-- Copyright (c) 2023 The SmartixOS Project -- Copyright (c) 2015 Pedro Souza -- Copyright (c) 2018 Kyle Evans + -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -29,6 +31,8 @@ -- $FreeBSD$ -- + +-- Required libraries local cli = require("cli") local core = require("core") local color = require("color") @@ -36,23 +40,174 @@ local screen = require("screen") local drawer = require("drawer") + + + -- LOCAL VARIABLES + +local theme = color.getTheme(color.MENU) + +-- The list of Initials to highlight. +-- The initials of certain phrases ( messages ) on the loader menu have been removed and made separate from the original sentences +-- to allow separate colorization of those initials. On the loader prompt, these +-- initials are also keyboard shortcuts that the user can type to access specific items on the loader menu. +-- The variables are declared as functions to take advantage of the immutability property of strings in Lua. +-- This trick allows for instantaneous change and near instantaneous rendition of the those initials after they have been stylized/colorized based on a theme. +-- Each section/portion of the loader menu is independently controlled by a bootloader variable. +-- These bootloader variables are declared in the script 'color.lua' and are listed here for reference: + +-- loader_brand_theme : controls the theme/color of the brand +-- loader_menu_theme : controls the theme/color of the menu +-- loader_logo_theme : controls the theme/color of the logo + +local MSG_A = function() +return color.escapefg(color.getTheme(color.MENU)) .. "A" .. color.resetfg() +end + +local MSG_B = function() +return color.escapefg(color.getTheme(color.MENU)) .. "B" .. color.resetfg() +end + +local MSG_C = function() +return color.escapefg(color.getTheme(color.MENU)) .. "C" .. color.resetfg() +end + +local MSG_D = function() +return color.escapefg(color.getTheme(color.MENU)) .. "D" .. color.resetfg() +end + +local MSG_E = function() +return color.escapefg(color.getTheme(color.MENU)) .. "E" .. color.resetfg() +end + +local MSG_L = function() +return color.escapefg(color.getTheme(color.MENU)) .. "L".. color.resetfg() +end + +local MSG_K = function() +return color.escapefg(color.getTheme(color.MENU)) .. "K" .. color.resetfg() +end + +local MSG_M = function() +return color.escapefg(color.getTheme(color.MENU)) .. "M" .. color.resetfg() +end + +local MSG_O = function() +return color.escapefg(color.getTheme(color.MENU)) .. "O" .. color.resetfg() +end + +local MSG_R = function() +return color.escapefg(color.getTheme(color.MENU)) .. "R" .. color.resetfg() +end + +local MSG_S = function() +return color.escapefg(color.getTheme(color.MENU)) .. "S".. color.resetfg() +end + +local MSG_V = function() +return color.escapefg(color.getTheme(color.MENU)) .. "V" .. color.resetfg() +end + +local MSG_b = function() +return color.escapefg(color.getTheme(color.MENU)) .. "b" .. color.resetfg() +end + + +local MSG_ENTER= function() +return color.escapefg(color.getTheme(color.MENU)) .. "Enter" .. color.resetfg() +end +local MSG_ESC = function() +return color.escapefg(color.getTheme(color.MENU)) .. "Esc" .. color.resetfg() +end + +local MSG_BACKSPACE = function() +return color.escapefg(color.getTheme(color.MENU)) .. "Backspace" .. color.resetfg() +end + + + +-- The list of messages displayed on the loader menu prompt. + +-- [B]"oot Multi user" +local MSG_OOT_MULTI_USER_ = "oot into Multi user " +--local OLD_MSG_OOT_MULTI_USER_ = "oot Multi user " + +local MSG_BOOT_INTO_ = "Boot into " +-- local OLD_MSG_BOOT__ = "Boot " + +-- [S]"ingle user" +local MSG_INGLE_USER = "ingle user" + +-- [C]"ons: " +local MSG_ONS_ = "onsole mode: " +-- local OLD_MSG_ONS_ = "ons: " + +-- [E]"scape to loader prompt" +local MSG_ESC_LOADER_PROMPT ="ape to loader prompt" + +-- "Reboot" +local MSG_EBOOT ="eboot" + +-- [K]"ernel list: " +local MSG_ERNEL_ ="ernel list: " +-- local OLD_MSG_ERNEL_ ="ernel: " + +local MSG_BOOT_ = "Boot " + +-- [O]"ptions +local MSG_PTIONS = "ptions" + +local MSG_LOAD_SYSTEM_ = "Load System " + +-- [D]"efaults" +local MSG_EFAULTS = "efaults" + +-- [A]"CPI :" +local MSG_CPI_ = "CPI :" + +local MSG_SAFE_ = "Safe " + +-- [M]"ode :" +local MSG_ODE_ = "ode :" + +local MSG_BCKTO_MAIN_MENU = "Back to main menu" + +local MSG_ACTIVE_ = "Active: " + +-- [V]"erbose :" +local MSG_ERBOSE_ ="erbose :" + +-- [A]"ctive: " +local MSG_CTIVE_ = "ctive: " + +-- [b]"ootfs: " +local MSG_OOTFS_ ="ootfs: " + +local MSG_SPACE="Space" + + + + local menu = {} local drawn_menu + local return_menu_entry = { - entry_type = core.MENU_RETURN, - name = "Back to main menu" .. color.highlight(" [Backspace]"), -} +entry_type = core.MENU_RETURN, +name = function() + return MSG_BCKTO_MAIN_MENU .. color.highlight(" [" .. MSG_BACKSPACE() .. "]") +end, + +} -- end return_menu_entry + local function OnOff(str, value) if value then - return str .. color.escapefg(color.GREEN) .. "On" .. - color.resetfg() + return str .. color.escapefg(color.GREEN) .. "On" .. color.resetfg() else - return str .. color.escapefg(color.RED) .. "off" .. - color.resetfg() + return str .. color.escapefg(color.RED) .. "off" .. color.resetfg() end -end +end -- function OnOff + local function bootenvSet(env) loader.setenv("vfs.root.mountfrom", env) @@ -75,352 +230,436 @@ -- have no bearing on whether we continue or not, indicating that we -- should just continue after execution. [core.MENU_ENTRY] = function(_, entry) - -- run function - entry.func() - end, + -- run function + entry.func() + end, -- end [core.MENU_ENTRY] + [core.MENU_CAROUSEL_ENTRY] = function(_, entry) - -- carousel (rotating) functionality - local carid = entry.carousel_id - local caridx = config.getCarouselIndex(carid) - local choices = entry.items - if type(choices) == "function" then - choices = choices() - end - if #choices > 0 then - caridx = (caridx % #choices) + 1 - config.setCarouselIndex(carid, caridx) - entry.func(caridx, choices[caridx], choices) - end - end, + -- carousel (rotating) functionality + local carousel_id = entry.carousel_id + local carousel_index = config.getCarouselIndex(carousel_id) + local choices = entry.items + if type(choices) == "function" then + choices = choices() + end + + if #choices > 0 then + carousel_index = (carousel_index % #choices) + 1 + config.setCarouselIndex(carousel_id, carousel_index) + entry.func(carousel_index, choices[carousel_index], choices) + end + + end, -- end [core.MENU_CAROUSEL_ENTRY] + [core.MENU_SUBMENU] = function(_, entry) - menu.process(entry.submenu) + menu.process(entry.submenu) end, + [core.MENU_RETURN] = function(_, entry) - -- allow entry to have a function/side effect - if entry.func ~= nil then - entry.func() - end - return false + -- allow entry to have a function/side effect + if entry.func ~= nil then + entry.func() + end + return false end, -} --- loader menu tree is rooted at menu.welcome -menu.boot_environments = { - entries = { - -- return to welcome menu - return_menu_entry, - { - entry_type = core.MENU_CAROUSEL_ENTRY, - carousel_id = "be_active", - items = core.bootenvList, - name = function(idx, choice, all_choices) - if #all_choices == 0 then - return "Active: " - end +} -- end menu.handlers - local is_default = (idx == 1) - local bootenv_name = "" - local name_color - if is_default then - name_color = color.escapefg(color.GREEN) - else - name_color = color.escapefg(color.BLUE) - end - bootenv_name = bootenv_name .. name_color .. - choice .. color.resetfg() - return color.highlight("A").."ctive: " .. - bootenv_name .. " (" .. idx .. " of " .. - #all_choices .. ")" - end, - func = function(_, choice, _) - bootenvSet(choice) - end, - alias = {"a", "A"}, - }, - { - entry_type = core.MENU_ENTRY, - visible = function() - return core.isRewinded() == false - end, - name = function() - return color.highlight("b") .. "ootfs: " .. - core.bootenvDefault() - end, - func = function() - -- Reset active boot environment to the default - config.setCarouselIndex("be_active", 1) - bootenvSet(core.bootenvDefault()) - end, - alias = {"b", "B"}, - }, - }, -} +-- loader menu tree is rooted at (start with the node ) menu.welcome + +menu.boot_environments = { + entries = { + -- return to welcome menu + return_menu_entry, + + { -- core.MENU_CAROUSEL_ENTRY + entry_type = core.MENU_CAROUSEL_ENTRY, + carousel_id = "be_active", + items = core.bootenvList, + name = function(idx, choice, all_choices) + if #all_choices == 0 then + -- MSG_ACTIVE_ = "Active: " + return MSG_ACTIVE_ + end + + local is_default = (idx == 1) + local bootenv_name = "" + local name_color + + if is_default then + name_color = color.escapefg(color.GREEN) + else + name_color = color.escapefg(color.BLUE) + end + + bootenv_name = bootenv_name .. name_color .. choice .. color.resetfg() + + -- MSG_CTIVE_ = "ctive: " + return color.highlight(MSG_A()) .. MSG_CTIVE_ .. bootenv_name .. " (" .. idx .. " of " .. #all_choices .. ")" + + end, + -- The function parameters are carousel_index, choice, choices + func = function(_, choice, _) + bootenvSet(choice) + end, + alias = {"a", "A"}, + + }, -- end core.MENU_CAROUSEL_ENTRY + + { -- core.MENU_ENTRY + entry_type = core.MENU_ENTRY, + + visible = function() + return core.isRewinded() == false + end, + + name = function() + + -- MSG_OOTFS_ ="ootfs: " + return color.highlight(MSG_b()) .. MSG_OOTFS_ .. core.bootenvDefault() + + end, + + func = function() + -- Reset active boot environment to the default + config.setCarouselIndex("be_active", 1) + bootenvSet(core.bootenvDefault()) + end, + + alias = {"b", "B"}, + + }, -- end core.MENU_ENTRY + + }, -- end entries + +} -- end menu.boot_environments + +-- option 7 in the boot menu menu.boot_options = { - entries = { - -- return to welcome menu - return_menu_entry, - -- load defaults - { - entry_type = core.MENU_ENTRY, - name = "Load System " .. color.highlight("D") .. - "efaults", - func = core.setDefaults, - alias = {"d", "D"}, - }, - { - entry_type = core.MENU_SEPARATOR, - }, - { - entry_type = core.MENU_SEPARATOR, - name = "Boot Options:", - }, - -- acpi - { - entry_type = core.MENU_ENTRY, - visible = core.isSystem386, - name = function() - return OnOff(color.highlight("A") .. - "CPI :", core.acpi) - end, - func = core.setACPI, - alias = {"a", "A"}, - }, - -- safe mode - { - entry_type = core.MENU_ENTRY, - name = function() - return OnOff("Safe " .. color.highlight("M") .. - "ode :", core.sm) - end, - func = core.setSafeMode, - alias = {"m", "M"}, - }, - -- single user - { - entry_type = core.MENU_ENTRY, - name = function() - return OnOff(color.highlight("S") .. - "ingle user:", core.su) - end, - func = core.setSingleUser, - alias = {"s", "S"}, - }, - -- verbose boot - { - entry_type = core.MENU_ENTRY, - name = function() - return OnOff(color.highlight("V") .. - "erbose :", core.verbose) - end, - func = core.setVerbose, - alias = {"v", "V"}, - }, - }, -} + entries = { + -- Back to main menu + return_menu_entry, + -- Load System Defaults + { + + entry_type = core.MENU_ENTRY, + name = function() + -- MSG_EFAULTS = "efaults" + return MSG_LOAD_SYSTEM_ .. color.highlight(MSG_D()) .. MSG_EFAULTS + end, + func = core.setDefaults, + alias = {"d", "D"}, + }, + + { + entry_type = core.MENU_SEPARATOR, + }, + + { + entry_type = core.MENU_SEPARATOR, + name = "Boot Options:", + }, + + -- acpi + { + entry_type = core.MENU_ENTRY, + visible = core.isSystem386, + name = function() + -- MSG_CPI_ = "CPI :" + return OnOff( color.highlight(MSG_A()) .. MSG_CPI_, core.acpi) + + end, + func = core.setACPI, + alias = {"a", "A"}, + }, + + -- safe mode + { + entry_type = core.MENU_ENTRY, + + name = function() + + return OnOff(MSG_SAFE_ .. color.highlight(MSG_M()) .. MSG_ODE_, core.sm) + + end, + func = core.setSafeMode, + alias = {"m", "M"}, + }, + -- single user + { + entry_type = core.MENU_ENTRY, + name = function() + -- MSG_INGLE_USER = "ingle user" + return OnOff( color.highlight(MSG_S()) .. MSG_INGLE_USER .. ":" , core.su) + + end, + func = core.setSingleUser, + alias = {"s", "S"}, + }, + -- verbose boot + { + entry_type = core.MENU_ENTRY, + name = function() + + return OnOff( color.highlight(MSG_V()) .. MSG_ERBOSE_ , core.verbose) + + end, + func = core.setVerbose, + alias = {"v", "V"}, + }, + + }, --end entries + +} -- end menu.boot_options menu.welcome = { - entries = function() - local menu_entries = menu.welcome.all_entries - local multi_user = menu_entries.multi_user - local single_user = menu_entries.single_user - local boot_entry_1, boot_entry_2 - if core.isSingleUserBoot() then - -- Swap the first two menu items on single user boot. - -- We'll cache the alternate entries for performance. - local alts = menu_entries.alts - if alts == nil then - single_user = core.deepCopyTable(single_user) - multi_user = core.deepCopyTable(multi_user) - single_user.name = single_user.alternate_name - multi_user.name = multi_user.alternate_name - menu_entries.alts = { - single_user = single_user, - multi_user = multi_user, - } - else - single_user = alts.single_user - multi_user = alts.multi_user - end - boot_entry_1, boot_entry_2 = single_user, multi_user - else - boot_entry_1, boot_entry_2 = multi_user, single_user - end - return { - boot_entry_1, - boot_entry_2, - menu_entries.prompt, - menu_entries.reboot, - menu_entries.console, - { - entry_type = core.MENU_SEPARATOR, - }, - { - entry_type = core.MENU_SEPARATOR, - name = "Options:", - }, - menu_entries.kernel_options, - menu_entries.boot_options, - menu_entries.zpool_checkpoints, - menu_entries.boot_envs, - menu_entries.chainload, - menu_entries.vendor, - } - end, - all_entries = { - multi_user = { - entry_type = core.MENU_ENTRY, - name = function() - return color.highlight("B") .. "oot " .. - multiUserPrompt() .. " " .. - color.highlight("[Enter]") - end, - -- Not a standard menu entry function! - alternate_name = function() - return color.highlight("B") .. "oot " .. - multiUserPrompt() - end, - func = function() - core.setSingleUser(false) - core.boot() - end, - alias = {"b", "B"}, - }, - single_user = { - entry_type = core.MENU_ENTRY, - name = "Boot " .. color.highlight("S") .. "ingle user", - -- Not a standard menu entry function! - alternate_name = "Boot " .. color.highlight("S") .. - "ingle user " .. color.highlight("[Enter]"), - func = function() - core.setSingleUser(true) - core.boot() - end, - alias = {"s", "S"}, - }, - console = { - entry_type = core.MENU_ENTRY, - name = function() - return color.highlight("C") .. "ons: " .. core.getConsoleName() - end, - func = function() - core.nextConsoleChoice() - end, - alias = {"c", "C"}, - }, - prompt = { - entry_type = core.MENU_RETURN, - name = color.highlight("Esc") .. "ape to loader prompt", - func = function() - loader.setenv("autoboot_delay", "NO") - end, - alias = {core.KEYSTR_ESCAPE}, - }, - reboot = { - entry_type = core.MENU_ENTRY, - name = color.highlight("R") .. "eboot", - func = function() - loader.perform("reboot") - end, - alias = {"r", "R"}, - }, - kernel_options = { - entry_type = core.MENU_CAROUSEL_ENTRY, - carousel_id = "kernel", - items = core.kernelList, - name = function(idx, choice, all_choices) - if #all_choices == 0 then - return "Kernel: " - end - local is_default = (idx == 1) - local kernel_name = "" - local name_color - if is_default then - name_color = color.escapefg(color.GREEN) - kernel_name = "default/" + entries = function() + local menu_entries = menu.welcome.all_entries + local multi_user = menu_entries.multi_user + local single_user = menu_entries.single_user + local boot_entry_1, boot_entry_2 + if core.isSingleUserBoot() then + -- Swap the first two menu items on single user boot. + -- We'll cache the alternate entries for performance. + local alts = menu_entries.alts + if alts == nil then + single_user = core.deepCopyTable(single_user) + multi_user = core.deepCopyTable(multi_user) + single_user.name = single_user.alternate_name + multi_user.name = multi_user.alternate_name + menu_entries.alts = { + single_user = single_user, + multi_user = multi_user, + } else - name_color = color.escapefg(color.BLUE) - end - kernel_name = kernel_name .. name_color .. - choice .. color.resetfg() - return color.highlight("K") .. "ernel: " .. - kernel_name .. " (" .. idx .. " of " .. - #all_choices .. ")" - end, - func = function(_, choice, _) - if loader.getenv("kernelname") ~= nil then - loader.perform("unload") + single_user = alts.single_user + multi_user = alts.multi_user end - config.selectKernel(choice) - end, - alias = {"k", "K"}, - }, - boot_options = { - entry_type = core.MENU_SUBMENU, - name = "Boot " .. color.highlight("O") .. "ptions", - submenu = menu.boot_options, - alias = {"o", "O"}, - }, - zpool_checkpoints = { - entry_type = core.MENU_ENTRY, - name = function() - local rewind = "No" - if core.isRewinded() then - rewind = "Yes" - end - return "Rewind ZFS " .. color.highlight("C") .. - "heckpoint: " .. rewind - end, - func = function() - core.changeRewindCheckpoint() - if core.isRewinded() then - bootenvSet( - core.bootenvDefaultRewinded()) - else - bootenvSet(core.bootenvDefault()) - end - config.setCarouselIndex("be_active", 1) - end, - visible = function() - return core.isZFSBoot() and - core.isCheckpointed() - end, - alias = {"c", "C"}, - }, - boot_envs = { - entry_type = core.MENU_SUBMENU, - visible = function() - return core.isZFSBoot() and - #core.bootenvList() > 1 - end, - name = "Boot " .. color.highlight("E") .. "nvironments", - submenu = menu.boot_environments, - alias = {"e", "E"}, - }, - chainload = { - entry_type = core.MENU_ENTRY, - name = function() - return 'Chain' .. color.highlight("L") .. - "oad " .. loader.getenv('chain_disk') - end, - func = function() - loader.perform("chain " .. - loader.getenv('chain_disk')) - end, - visible = function() - return loader.getenv('chain_disk') ~= nil - end, - alias = {"l", "L"}, - }, - vendor = { - entry_type = core.MENU_ENTRY, - visible = function() - return false + boot_entry_1, boot_entry_2 = single_user, multi_user + else + boot_entry_1, boot_entry_2 = multi_user, single_user end - }, - }, -} + return { + boot_entry_1, + boot_entry_2, + menu_entries.prompt, + menu_entries.reboot, + menu_entries.console, + { + entry_type = core.MENU_SEPARATOR, + }, + { + entry_type = core.MENU_SEPARATOR, + name = "Advanced Options:", + }, + menu_entries.kernel_options, + menu_entries.boot_options, + menu_entries.zpool_checkpoints, + menu_entries.boot_envs, + menu_entries.chainload, + menu_entries.vendor, + } + end, -- end entries + + all_entries = { + multi_user = { + entry_type = core.MENU_ENTRY, + name = function() + -- MSG_OOT_MULTI_USER_ = "oot Multi user " + return color.highlight(MSG_B() ) .. MSG_OOT_MULTI_USER_ .. color.highlight("[" .. MSG_ENTER() .. "]") + end, + + -- Not a standard menu entry function! + alternate_name = function() + + return color.highlight( MSG_B() ) .. MSG_OOT_MULTI_USER_ + end, + func = function() + core.setSingleUser(false) + core.boot() + end, + alias = {"b", "B"}, + }, -- end multi_user + + single_user = { + entry_type = core.MENU_ENTRY, + + name = function() + -- MSG_INGLE_USER = "ingle user" + return MSG_BOOT_INTO_ .. color.highlight(MSG_S()) .. MSG_INGLE_USER + end, + + -- Not a standard menu entry function! + alternate_name = function() + + return MSG_BOOT_INTO_ .. color.highlight(MSG_S()) .. MSG_INGLE_USER .. " " .. color.highlight("[" .. MSG_ENTER() .."]") + end, + + func = function() + core.setSingleUser(true) + core.boot() + end, + alias = {"s", "S"}, + }, -- end single_user + + console = { + entry_type = core.MENU_ENTRY, + + name = function() + -- MSG_ONS_ = "ons: " + return color.highlight(MSG_C()) .. MSG_ONS_ .. core.getConsoleName() + + end, + func = function() + core.nextConsoleChoice() + end, + alias = {"c", "C"}, + }, -- end console + + prompt = { + entry_type = core.MENU_RETURN, + + name = function() + -- MSG_ESC="Esc" MSG_ESC_LOADER_PROMPT ="ape to loader prompt" + return color.highlight(MSG_ESC()) .. MSG_ESC_LOADER_PROMPT + end, + + func = function() + loader.setenv("autoboot_delay", "NO") + end, + + alias = {core.KEYSTR_ESCAPE}, + }, -- end prompt + + reboot = { + entry_type = core.MENU_ENTRY, + + name = function() + -- MSG_EBOOT ="eboot" + return color.highlight(MSG_R()) .. MSG_EBOOT + end, + + func = function() + loader.perform("reboot") + end, + + alias = {"r", "R"}, + }, -- end reboot + + kernel_options = { + entry_type = core.MENU_CAROUSEL_ENTRY, + carousel_id = "kernel", + items = core.kernelList, + name = function(idx, choice, all_choices) + if #all_choices == 0 then + + return color.highlight(MSG_K()) .. MSG_ERNEL_ + -- return "Kernel: " + end + + local is_default = (idx == 1) + local kernel_name = "" + local name_color + if is_default then + name_color = color.escapefg(color.GREEN) + kernel_name = "default/" + else + name_color = color.escapefg(color.BLUE) + end + kernel_name = kernel_name .. name_color .. + choice .. color.resetfg() + + -- MSG_ERNEL_ ="ernel Selection: " + return color.highlight(MSG_K()) .. MSG_ERNEL_ .. kernel_name .. " ("..idx.." of "..#all_choices..")" + end, + + func = function(_, choice, _) + if loader.getenv("kernelname") ~= nil then + loader.perform("unload") + end + config.selectKernel(choice) + end, + alias = {"k", "K"}, + }, --end kernel_options + + boot_options = { + entry_type = core.MENU_SUBMENU, + + name = function() + -- MSG_BOOT_ = "Boot " + return MSG_BOOT_ .. color.highlight(MSG_O()) .. "ptions" + end, + + submenu = menu.boot_options, + alias = {"o", "O"}, + }, -- end boot_options + + zpool_checkpoints = { + entry_type = core.MENU_ENTRY, + name = function() + local rewind = "No" + if core.isRewinded() then + rewind = "Yes" + end + return "Rewind ZFS " .. color.highlight(MSG_C()) .. "heckpoint: " .. rewind + end, + func = function() + core.changeRewindCheckpoint() + if core.isRewinded() then + bootenvSet( + core.bootenvDefaultRewinded()) + else + bootenvSet(core.bootenvDefault()) + end + config.setCarouselIndex("be_active", 1) + end, + visible = function() + return core.isZFSBoot() and + core.isCheckpointed() + end, + alias = {"c", "C"}, + }, -- end zpool_checkpoints + + boot_envs = { + entry_type = core.MENU_SUBMENU, + visible = function() + return core.isZFSBoot() and + #core.bootenvList() > 1 + end, + + name = MSG_BOOT_ .. color.highlight(MSG_E()).."nvironments", + submenu = menu.boot_environments, + alias = {"e", "E"}, + }, -- end boot_envs + + chainload = { + entry_type = core.MENU_ENTRY, + name = function() + + return 'Chain' .. color.highlight(MSG_L()).."oad ".. loader.getenv('chain_disk') + end, + func = function() + loader.perform("chain " .. + loader.getenv('chain_disk')) + end, + visible = function() + return loader.getenv('chain_disk') ~= nil + end, + alias = {"l", "L"}, + }, -- end chainload + + vendor = { + entry_type = core.MENU_ENTRY, + visible = function() + return false + end + }, -- end vendor + + }, -- end all_entries + +} -- end menu.welcome menu.default = menu.welcome -- current_alias_table will be used to keep our alias table consistent across @@ -429,138 +668,139 @@ menu.current_alias_table = {} function menu.draw(menudef) - -- Clear the screen, reset the cursor, then draw - screen.clear() - menu.current_alias_table = drawer.drawscreen(menudef) - drawn_menu = menudef - screen.defcursor() -end +-- Clear the screen, reset the cursor, then draw +screen.clear() +menu.current_alias_table = drawer.drawscreen(menudef) +drawn_menu = menudef +screen.defcursor() +end -- function menu.draw -- 'keypress' allows the caller to indicate that a key has been pressed that we -- should process as our initial input. function menu.process(menudef, keypress) assert(menudef ~= nil) - + if drawn_menu ~= menudef then - menu.draw(menudef) + menu.draw(menudef) end - + while true do - local key = keypress or io.getchar() - keypress = nil - - -- Special key behaviors - if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and - menudef ~= menu.default then - break - elseif key == core.KEY_ENTER then - core.boot() - -- Should not return. If it does, escape menu handling - -- and drop to loader prompt. - return false - end - - key = string.char(key) - -- check to see if key is an alias - local sel_entry = nil - for k, v in pairs(menu.current_alias_table) do - if key == k then - sel_entry = v - break - end - end - - -- if we have an alias do the assigned action: - if sel_entry ~= nil then - local handler = menu.handlers[sel_entry.entry_type] - assert(handler ~= nil) - -- The handler's return value indicates if we - -- need to exit this menu. An omitted or true - -- return value means to continue. - if handler(menudef, sel_entry) == false then - return - end - -- If we got an alias key the screen is out of date... - -- redraw it. - menu.draw(menudef) - end - end -end + local key = keypress or io.getchar() + keypress = nil + + -- Special key behaviors + if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and + menudef ~= menu.default then + break + elseif key == core.KEY_ENTER then + core.boot() + -- Should not return. If it does, escape menu handling + -- and drop to loader prompt. + return false + end + + key = string.char(key) + -- check to see if key is an alias + local sel_entry = nil + for k, v in pairs(menu.current_alias_table) do + if key == k then + sel_entry = v + break + end + end -- end for + + -- if we have an alias do the assigned action: + if sel_entry ~= nil then + local handler = menu.handlers[sel_entry.entry_type] + assert(handler ~= nil) + -- The handler's return value indicates if we + -- need to exit this menu. An omitted or true + -- return value means to continue. + if handler(menudef, sel_entry) == false then + return + end + -- If we got an alias key the screen is out of date... + -- redraw it. + menu.draw(menudef) + end + end -- end while + +end -- function menu.process function menu.run() local autoboot_key local delay = loader.getenv("autoboot_delay") - + if delay ~= nil and delay:lower() == "no" then - delay = nil + delay = nil else - delay = tonumber(delay) or 10 + delay = tonumber(delay) or 10 end - + if delay == -1 then - core.boot() - return + core.boot() + return end - + menu.draw(menu.default) - + if delay ~= nil then - autoboot_key = menu.autoboot(delay) - - -- autoboot_key should return the key pressed. It will only - -- return nil if we hit the timeout and executed the timeout - -- command. Bail out. - if autoboot_key == nil then - return - end + autoboot_key = menu.autoboot(delay) + + -- autoboot_key should return the key pressed. It will only + -- return nil if we hit the timeout and executed the timeout + -- command. Bail out. + if autoboot_key == nil then + return + end end - + menu.process(menu.default, autoboot_key) drawn_menu = nil - + screen.defcursor() print("Exiting menu!") -end +end -- function menu.run function menu.autoboot(delay) - local x = loader.getenv("loader_menu_timeout_x") or 4 - local y = loader.getenv("loader_menu_timeout_y") or 23 - local endtime = loader.time() + delay - local time - local last - repeat - time = endtime - loader.time() - if last == nil or last ~= time then - last = time - screen.setcursor(x, y) - print("Autoboot in " .. time .. - " seconds. [Space] to pause ") - screen.defcursor() - end - if io.ischar() then - local ch = io.getchar() - if ch == core.KEY_ENTER then - break - else - -- erase autoboot msg - screen.setcursor(0, y) - print(string.rep(" ", 80)) - screen.defcursor() - return ch - end - end - - loader.delay(50000) - until time <= 0 - - local cmd = loader.getenv("menu_timeout_command") or "boot" - cli_execute_unparsed(cmd) - return nil -end - + local x = loader.getenv("loader_menu_timeout_x") or 4 + local y = loader.getenv("loader_menu_timeout_y") or 23 + local endtime = loader.time() + delay + local time + local last + repeat + time = endtime - loader.time() + if last == nil or last ~= time then + last = time + + screen.setcursor(x, y) + print("Autoboot in " .. time .. " seconds. [" .. color.highlight(color.escapefg(color.RED) .. MSG_SPACE .. color.resetfg()) .. "] to pause ") + screen.defcursor() + end + + if io.ischar() then + local ch = io.getchar() + if ch == core.KEY_ENTER then + break + else + -- erase autoboot msg + screen.setcursor(0, y) + print(string.rep(" ", 80)) + screen.defcursor() + return ch + end + end + + loader.delay(50000) + until time <= 0 + + local cmd = loader.getenv("menu_timeout_command") or "boot" + cli_execute_unparsed(cmd) + return nil +end -- end function menu.autoboot -- CLI commands function cli.menu() - menu.run() +menu.run() end return menu