简体   繁体   English

Chrome扩展程序用户界面

[英]Chrome Extension User Interface

I have written my Google Chrome extension and now have a basic interface for Options and Browser Action Popups. 我编写了Google Chrome扩展程序,现在有一个用于选项和浏览器操作弹出窗口的基本界面。 But the look and feel differs in Mac, Windows and Linux. 但Mac,Windows和Linux的外观和感觉有所不同。

I want to create the same look and feel for cross platform, and a bit fancier if possible. 我想为跨平台创建相同的外观和感觉,如果可能的话,有点发烧友。 I mean I want all possible HTML elements, eg checkbox, radio, select, option tag to style same for cross platform. 我的意思是我想要所有可能的HTML元素,例如复选框,收音机,选择,选项标签,以便为跨平台设置相同的样式。

I am lacking design skills and looking for a quick and ready solution. 我缺乏设计技巧,正在寻找快速准备的解决方案。 Is there any CSS or Javascript library to create the same user interface for all operating systems? 是否有任何CSS或Javascript库为所有操作系统创建相同的用户界面?

What you're requesting is a highly-demanded feature (though not implemented yet), see Issue 25317: Help extensions authors make options pages with a consistent look on Chromium's bug tracker. 您要求的是一个高要求的功能(虽然尚未实现),请参阅问题25317:帮助扩展程序作者在Chromium的错误跟踪器上创建具有一致外观的选项页面

When you implement an options page, you could take either of the two next methods: 实现选项页面时,可以采用以下两种方法之一:

  1. Implement a pixel-perfect UI that looks identical on Linux, Mac and Windows. 实现像素完美的UI,在Linux,Mac和Windows上看起来完全相同。
  2. Implement a UI using native controls of the relevant platforms. 使用相关平台的本机控件实现UI。

I suggest to follow approach 2, because the most important part of an options page is the ability to quickly set preferences. 我建议遵循方法2,因为选项页面最重要的部分是快速设置首选项的能力。 This is achieved by using controls that are familiar to the user. 这是通过使用用户熟悉的控件来实现的。

So, start with the basic unstyled HTML to get the main purpose right. 因此,从基本的无格式HTML开始,以达到主要目的。 Eg: 例如:

<label>
    <input type="checkbox" id="some-option-id">
    <span>Some option</span>
</label>

When you've done that, you could dress up the UI with CSS if you wish. 完成后,如果您愿意,可以使用CSS打扮UI。 But don't overdo it: users should still be able to recognize a checkbox. 但是不要过度:用户应该仍然能够识别复选框。

If your app specifically demands for platform-specific colors, use CSS color keywords such as ButtonFace , ButtonText , CaptionText , etc. You can find more of these keywords in Chromium's source code . 如果您的应用特别需要特定于平台的颜色,请使用CSS颜色关键字,如ButtonFaceButtonTextCaptionText等。您可以在Chromium的源代码中找到更多这些关键字。

I have made a small UI kit especially for chrome extensions which resembles the exact look and feel of the default chrome settings page. 我制作了一个小型UI工具包,特别适用于镀铬扩展,类似于默认镀铬设置页面的确切外观。 Give it a look at http://code.compzets.com/css-kit-for-chrome-extensions/ . 请查看http://code.compzets.com/css-kit-for-chrome-extensions/

I have also used this for my own extension SimpleFill. 我也将它用于我自己的扩展SimpleFill。

Following your update, perhaps you are looking for something like Bootstrap . 在您更新之后,也许您正在寻找像Bootstrap这样的东西。 There are many alternatives, for example see this answer: https://stackoverflow.com/a/9214391/2022285 有许多替代方案,例如,请参阅此答案: https//stackoverflow.com/a/9214391/2022285

It should be noted that because the Chrome platform is designed to build on the web platform, it is conceivable to use any type of client JavaScript / CSS libraries in your Extensions (certain security policies notwithstanding) 应该注意的是,由于Chrome平台旨在构建在Web平台上,因此可以设想在扩展中使用任何类型的客户端JavaScript / CSS库(尽管有某些安全策略)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM