无忧启动论坛

标题: 切换两种配色方案的方法 [打印本页]

作者: 2011hnfeng    时间: 2011-12-29 17:39
标题: 切换两种配色方案的方法
本来我想使用两种菜单的配色方案(背景图+菜单颜色),采用两个 menu.lst 文件(menu-blue.lst, menu-green.lst),在第一个 title 里面互相 configfile:

绿色配色方案 menu-green.lst
===================
timeout 99
font /grub/unifont.hex.gz
graphicsmode -1 480:640
# Green
color black/green yellow/cyan cyan/green dark-gray/green
color border=0x33
splashimage /grub/green480x640.bmp.gz
/grub/MINI_MENUSET 0 4 1 19 17 2 75 3
title 系统维护工具
configfile /menu-blue.lst
clear
title 1
......
===================

蓝色配色方案 menu-blue.lst
===================
timeout 99
font /grub/unifont.hex.gz
graphicsmode -1 480:640
# Blue
color cyan/light-blue yellow/light-blue light-blue/dark-gray blue/light-blue
color border=0x33
splashimage /grub/blue480x640.bmp.gz
/grub/MINI_MENUSET 0 4 1 19 17 2 75 3
title 系统维护工具
configfile /menu-green.lst
clear
title 1
......
===================

在第一个 title 上按回车键就可以切换两种配色方案(按 0 可定位到 第一个 title)

后来感觉使用两个 menu.lst 不方便,今天翻看了一下说明文档(CHM),找到有 set 和 if 命令,更改了一下,只需一个 menu.lst 即能实现切换不同配色方案。

===================
timeout 99
font /grub/unifont.hex.gz
graphicsmode -1 480:640
color 0x20 0x3E 0x13 0x28
# 使用两位数的颜色代码简化了一点
color border=0x33
splashimage /grub/green480x640.bmp.gz
set MyColor=green
/grub/MINI_MENUSET 0 4 1 19 17 2 75 3
title 系统维护工具
# 隐藏切换配色方案的功能
if /I %MyColor%==blue color 0x20 0x3E 0x13 0x28 && splashimage /grub/green480x640.bmp.gz
if /I %MyColor%==green color 0x93 0x9E 0x89 0x91 && splashimage /grub/blue480x640.bmp.gz
if /I %MyColor%==green set MyColor=blue || if /I %MyColor%==blue set MyColor=green
clear
title ------
clear
......
===================

在 vmware 中测试通过。

[ 本帖最后由 2011hnfeng 于 2011-12-29 18:06 编辑 ]

2011-12-27 17-46-22_50.png (96.93 KB, 下载次数: 59)

2011-12-27 17-46-22_50.png

2011-12-27 17-41-42_50.png (93.87 KB, 下载次数: 51)

2011-12-27 17-41-42_50.png

作者: Hcrty    时间: 2011-12-29 17:42
- -|||,把测试文件和核心(grub相关文件)打包上传




欢迎光临 无忧启动论坛 (http://bbs.wuyou.net/) Powered by Discuz! X3.3