当前位置: 首页>>代码示例>>PHP>>正文


PHP td_util::html2rgb方法代码示例

本文整理汇总了PHP中td_util::html2rgb方法的典型用法代码示例。如果您正苦于以下问题:PHP td_util::html2rgb方法的具体用法?PHP td_util::html2rgb怎么用?PHP td_util::html2rgb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在td_util的用法示例。


在下文中一共展示了td_util::html2rgb方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: td_css_generator


//.........这里部分代码省略.........
    //load the user settings
    // general
    $td_css_compiler->load_setting('theme_color');
    $td_css_compiler->load_setting('grid_line_color');
    // header ---------
    $td_css_compiler->load_setting('top_menu_color');
    $td_css_compiler->load_setting('top_menu_text_color');
    $td_css_compiler->load_setting('top_menu_text_hover_color');
    $td_css_compiler->load_setting('top_sub_menu_text_color');
    $td_css_compiler->load_setting('top_sub_menu_text_hover_color');
    $td_css_compiler->load_setting('top_social_icons_color');
    $td_css_compiler->load_setting('top_social_icons_hover_color');
    $td_css_compiler->load_setting('menu_color');
    $td_css_compiler->load_setting('menu_text_color');
    $td_css_compiler->load_setting('menu_border_color');
    $td_css_compiler->load_setting('header_wrap_color');
    // footer ---------
    $td_css_compiler->load_setting('footer_color');
    $td_css_compiler->load_setting('footer_bottom_color');
    $td_css_compiler->load_setting('footer_bottom_text_color');
    // posts
    $td_css_compiler->load_setting('post_title_color');
    $td_css_compiler->load_setting('post_author_name_color');
    $td_css_compiler->load_setting('post_content_color');
    $td_css_compiler->load_setting('post_h_color');
    $td_css_compiler->load_setting('post_blockquote_color');
    // pages
    $td_css_compiler->load_setting('page_title_color');
    $td_css_compiler->load_setting('page_content_color');
    $td_css_compiler->load_setting('page_h_color');
    // modules and blocks
    $td_css_compiler->load_setting('module1_title_color');
    $td_css_compiler->load_setting('module2_title_color');
    $td_css_compiler->load_setting('module3_title_color');
    $td_css_compiler->load_setting('module4_title_color');
    $td_css_compiler->load_setting('module5_title_color');
    $td_css_compiler->load_setting('module6_title_color');
    $td_css_compiler->load_setting('module7_title_color');
    $td_css_compiler->load_setting('module8_title_color');
    $td_css_compiler->load_setting('module9_title_color');
    $td_css_compiler->load_setting('module10_title_color');
    $td_css_compiler->load_setting('module11_title_color');
    $td_css_compiler->load_setting('module12_title_color');
    $td_css_compiler->load_setting('module13_title_color');
    $td_css_compiler->load_setting('module14_title_color');
    $td_css_compiler->load_setting('module15_title_color');
    $td_css_compiler->load_setting('module_mx2_title_color');
    $td_css_compiler->load_setting('module_mx4_title_color');
    $td_css_compiler->load_setting('news_ticker_title_color');
    $td_css_compiler->load_setting('author_name_title_color');
    //load the selection color
    $tds_theme_color = td_util::get_option('tds_theme_color');
    if (!empty($tds_theme_color)) {
        //the select
        $td_css_compiler->load_setting_raw('select_color', td_util::adjustBrightness($tds_theme_color, 50));
        //the sliders text
        $td_css_compiler->load_setting_raw('slider_text', td_util::hex2rgba($tds_theme_color, 0.7));
    }
    /**
     * add td_fonts_css_buffer from database into the source of the page
     *
     * td_fonts_css_buffer : used to store the css generated for custom font files in the database
     */
    $td_fonts_css_buffer = td_fonts::td_add_fonts_css_buffer();
    /* add block styles */
    $td_block_styles = td_util::get_option('td_block_styles');
    //check if we have something set by the user
    if (!empty($td_block_styles)) {
        foreach ($td_block_styles as $style_name => $array_style_options) {
            foreach ($array_style_options as $option_key => $option_val) {
                if (!empty($td_block_styles[$style_name][$option_key])) {
                    $option_name_generator = str_replace('tds_', $style_name . '_', $option_key);
                    switch ($option_key) {
                        case 'tds_block_drop_down_background_color':
                            $td_css_compiler->load_setting_raw($option_name_generator, td_util::hex2rgba($td_block_styles[$style_name][$option_key], 0.95));
                            $td_css_compiler->load_setting_raw($option_name_generator . '_ie8', $td_block_styles[$style_name][$option_key]);
                            break;
                        case 'tds_block_module_post_comments_box_background_color':
                            $td_css_compiler->load_setting_raw($option_name_generator, $td_block_styles[$style_name][$option_key]);
                            //converting hex color to rgb
                            $rgb_color = td_util::html2rgb($td_block_styles[$style_name][$option_key]);
                            //converting rgb to hsl
                            $hsl_color = td_util::rgb2Hsl($rgb_color[0], $rgb_color[1], $rgb_color[2]);
                            //this is a hack for HLS color: red is 0 in HLS and no output is generated
                            if (intval($hsl_color[0] == 0)) {
                                $hsl_color[0] = 1;
                            }
                            $td_css_compiler->load_setting_raw($option_name_generator . '_after', $hsl_color[0]);
                            break;
                        default:
                            $td_css_compiler->load_setting_raw($option_name_generator, $td_block_styles[$style_name][$option_key]);
                    }
                }
            }
        }
    }
    //output the style
    //td_css_buffer::add($td_css_compiler->compile_css());
    return $td_fonts_css_buffer . $td_css_compiler->compile_css();
}
开发者ID:vikasjain1595,项目名称:wordpresstheme,代码行数:101,代码来源:td_css_generator.php


注:本文中的td_util::html2rgb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。